]> git.baikalelectronics.ru Git - kernel.git/commit
nfsd: Fix nsfd startup race (again)
authorAlexander Sverdlin <alexander.sverdlin@nokia.com>
Tue, 7 Dec 2021 14:00:39 +0000 (15:00 +0100)
committerJ. Bruce Fields <bfields@redhat.com>
Fri, 10 Dec 2021 16:54:59 +0000 (11:54 -0500)
commitf123ffe76b71732f57d5fef90850f8145d146392
treeeb69e5e677f47ae4e1af278ad871508935fe1e7b
parentbcaa5780ddbeacad7e998e7957fc9a3a5a94c857
nfsd: Fix nsfd startup race (again)

Commit 375b1e5b9c80 ("nfsd: register pernet ops last, unregister first")
has re-opened rpc_pipefs_event() race against nfsd_net_id registration
(register_pernet_subsys()) which has been fixed by commit d6ea68029b24
("nfsd: fix nsfd startup race triggering BUG_ON").

Restore the order of register_pernet_subsys() vs register_cld_notifier().
Add WARN_ON() to prevent a future regression.

Crash info:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000012
CPU: 8 PID: 345 Comm: mount Not tainted 5.4.144-... #1
pc : rpc_pipefs_event+0x54/0x120 [nfsd]
lr : rpc_pipefs_event+0x48/0x120 [nfsd]
Call trace:
 rpc_pipefs_event+0x54/0x120 [nfsd]
 blocking_notifier_call_chain
 rpc_fill_super
 get_tree_keyed
 rpc_fs_get_tree
 vfs_get_tree
 do_mount
 ksys_mount
 __arm64_sys_mount
 el0_svc_handler
 el0_svc

Fixes: 375b1e5b9c80 ("nfsd: register pernet ops last, unregister first")
Cc: stable@vger.kernel.org
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4recover.c
fs/nfsd/nfsctl.c