Skip to content

Commit 1d62505

Browse files
pho9chucklever
authored andcommitted
nfsd: fix error handling of register_pernet_subsys() in init_nfsd()
init_nfsd() should not unregister pernet subsys if the register fails but should instead unwind from the last successful operation which is register_filesystem(). Unregistering a failed register_pernet_subsys() call can result in a kernel GPF as revealed by programmatically injecting an error in register_pernet_subsys(). Verified the fix handled failure gracefully with no lingering nfsd entry in /proc/filesystems. This change was introduced by the commit bd5ae92 ("nfsd: register pernet ops last, unregister first"), the original error handling logic was correct. Fixes: bd5ae92 ("nfsd: register pernet ops last, unregister first") Cc: [email protected] Signed-off-by: Patrick Ho <[email protected]> Acked-by: J. Bruce Fields <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 02579b2 commit 1d62505

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/nfsd/nfsctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,7 @@ static int __init init_nfsd(void)
15451545
goto out_free_all;
15461546
return 0;
15471547
out_free_all:
1548-
unregister_pernet_subsys(&nfsd_net_ops);
1548+
unregister_filesystem(&nfsd_fs_type);
15491549
out_free_exports:
15501550
remove_proc_entry("fs/nfs/exports", NULL);
15511551
remove_proc_entry("fs/nfs", NULL);

0 commit comments

Comments
 (0)