summaryrefslogtreecommitdiffstats
path: root/fs/lockd/svc.c
diff options
context:
space:
mode:
authorScott Mayhew <smayhew@redhat.com>2016-06-30 10:39:32 -0400
committerJ. Bruce Fields <bfields@redhat.com>2016-06-30 16:35:07 -0400
commitcb7d224f82e41d82518e7f9ea271d215d4d08e6e (patch)
tree6fe7e8fe627d4edb00a6587b96f20329f5b7df2c /fs/lockd/svc.c
parent4c2e07c6a29e0129e975727b9f57eede813eea85 (diff)
downloadlinux-stable-cb7d224f82e41d82518e7f9ea271d215d4d08e6e.tar.gz
linux-stable-cb7d224f82e41d82518e7f9ea271d215d4d08e6e.tar.bz2
linux-stable-cb7d224f82e41d82518e7f9ea271d215d4d08e6e.zip
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: 0751ddf77b6a "lockd: Register callbacks on the inetaddr_chain..." Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/lockd/svc.c')
-rw-r--r--fs/lockd/svc.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 154a107cd376..fc4084ef4736 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -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);
}
@@ -462,7 +467,7 @@ 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);
@@ -470,7 +475,9 @@ err_create:
err_start:
lockd_down_net(serv, net);
- goto err_net;
+err_net:
+ lockd_unregister_notifiers();
+ goto err_put;
}
EXPORT_SYMBOL_GPL(lockd_up);