Skip to content

Commit

Permalink
lockd: unregister notifier blocks if the service fails to come up com…
Browse files Browse the repository at this point in the history
…pletely

If the lockd service fails to start up then we need to be sure that the
notifier blocks are not registered, otherwise a subsequent start of the
service could cause the same notifier to be registered twice, leading to
soft lockups.

Signed-off-by: Scott Mayhew <[email protected]>
Cc: [email protected]
Fixes: 0751ddf "lockd: Register callbacks on the inetaddr_chain..."
Signed-off-by: J. Bruce Fields <[email protected]>
  • Loading branch information
scottmayhew authored and J. Bruce Fields committed Jun 30, 2016
1 parent 4c2e07c commit cb7d224
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions fs/lockd/svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,17 @@ static struct notifier_block lockd_inet6addr_notifier = {
};
#endif

static void lockd_svc_exit_thread(void)
static void lockd_unregister_notifiers(void)
{
unregister_inetaddr_notifier(&lockd_inetaddr_notifier);
#if IS_ENABLED(CONFIG_IPV6)
unregister_inet6addr_notifier(&lockd_inet6addr_notifier);
#endif
}

static void lockd_svc_exit_thread(void)
{
lockd_unregister_notifiers();
svc_exit_thread(nlmsvc_rqst);
}

Expand Down Expand Up @@ -462,15 +467,17 @@ int lockd_up(struct net *net)
* Note: svc_serv structures have an initial use count of 1,
* so we exit through here on both success and failure.
*/
err_net:
err_put:
svc_destroy(serv);
err_create:
mutex_unlock(&nlmsvc_mutex);
return error;

err_start:
lockd_down_net(serv, net);
goto err_net;
err_net:
lockd_unregister_notifiers();
goto err_put;
}
EXPORT_SYMBOL_GPL(lockd_up);

Expand Down

0 comments on commit cb7d224

Please sign in to comment.