]> git.baikalelectronics.ru Git - kernel.git/commit
nfsd: fix error handling of register_pernet_subsys() in init_nfsd()
authorPatrick Ho <Patrick.Ho@netapp.com>
Sat, 21 Aug 2021 06:56:26 +0000 (02:56 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Thu, 30 Sep 2021 14:58:52 +0000 (10:58 -0400)
commit438632b40f8eadc6b6c60a2fb915e65de529f9a6
treefb7ee0160c5035a2ea424b9e27bb1529f9191311
parent862ee0792b56294451e0e9758795b145596810d0
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
41db07988723 ("nfsd: register pernet ops last, unregister first"),
the original error handling logic was correct.

Fixes: 41db07988723 ("nfsd: register pernet ops last, unregister first")
Cc: stable@vger.kernel.org
Signed-off-by: Patrick Ho <Patrick.Ho@netapp.com>
Acked-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfsctl.c