diff mbox series

[v2,1/2] nfsd: Unregister the cld notifier when laundry_wq create failed

Message ID 20220521040845.619409-2-zhangxiaoxu5@huawei.com (mailing list archive)
State New
Headers show
Series Fix null-ptr-deref in nfsd_fill_super() | expand

Commit Message

Zhang Xiaoxu May 21, 2022, 4:08 a.m. UTC
If laundry_wq create failed, the cld notifier should be unregistered.

Fixes: d76cc46b37e1 ("NFSD: move create/destroy of laundry_wq to init_nfsd and exit_nfsd")
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
---
 fs/nfsd/nfsctl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 322a208878f2..55949e60897d 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -1543,12 +1543,14 @@  static int __init init_nfsd(void)
 		goto out_free_filesystem;
 	retval = register_cld_notifier();
 	if (retval)
-		goto out_free_all;
+		goto out_free_subsys;
 	retval = nfsd4_create_laundry_wq();
 	if (retval)
 		goto out_free_all;
 	return 0;
 out_free_all:
+	unregister_cld_notifier();
+out_free_subsys:
 	unregister_pernet_subsys(&nfsd_net_ops);
 out_free_filesystem:
 	unregister_filesystem(&nfsd_fs_type);