Skip to content

Commit cb7d224

Browse files
scottmayhewJ. Bruce Fields
authored andcommitted
lockd: unregister notifier blocks if the service fails to come up completely
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 <smayhew@redhat.com> Cc: stable@vger.kernel.org Fixes: 0751ddf "lockd: Register callbacks on the inetaddr_chain..." Signed-off-by: J. Bruce Fields <bfields@redhat.com>
1 parent 4c2e07c commit cb7d224

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

fs/lockd/svc.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,12 +335,17 @@ static struct notifier_block lockd_inet6addr_notifier = {
335335
};
336336
#endif
337337

338-
static void lockd_svc_exit_thread(void)
338+
static void lockd_unregister_notifiers(void)
339339
{
340340
unregister_inetaddr_notifier(&lockd_inetaddr_notifier);
341341
#if IS_ENABLED(CONFIG_IPV6)
342342
unregister_inet6addr_notifier(&lockd_inet6addr_notifier);
343343
#endif
344+
}
345+
346+
static void lockd_svc_exit_thread(void)
347+
{
348+
lockd_unregister_notifiers();
344349
svc_exit_thread(nlmsvc_rqst);
345350
}
346351

@@ -462,15 +467,17 @@ int lockd_up(struct net *net)
462467
* Note: svc_serv structures have an initial use count of 1,
463468
* so we exit through here on both success and failure.
464469
*/
465-
err_net:
470+
err_put:
466471
svc_destroy(serv);
467472
err_create:
468473
mutex_unlock(&nlmsvc_mutex);
469474
return error;
470475

471476
err_start:
472477
lockd_down_net(serv, net);
473-
goto err_net;
478+
err_net:
479+
lockd_unregister_notifiers();
480+
goto err_put;
474481
}
475482
EXPORT_SYMBOL_GPL(lockd_up);
476483

0 commit comments

Comments
 (0)