diff options
author | Zhang Xiaoxu <zhangxiaoxu5@huawei.com> | 2022-05-21 06:08:45 +0200 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2022-05-23 17:06:29 +0200 |
commit | 6f6f84aa215f7b6665ccbb937db50860f9ec2989 (patch) | |
tree | e4f849fb15f85c274d3536183099a875b35763e9 /fs/cifs/smbdirect.h | |
parent | nfsd: Unregister the cld notifier when laundry_wq create failed (diff) | |
download | linux-6f6f84aa215f7b6665ccbb937db50860f9ec2989.tar.xz linux-6f6f84aa215f7b6665ccbb937db50860f9ec2989.zip |
nfsd: Fix null-ptr-deref in nfsd_fill_super()
KASAN report null-ptr-deref as follows:
BUG: KASAN: null-ptr-deref in nfsd_fill_super+0xc6/0xe0 [nfsd]
Write of size 8 at addr 000000000000005d by task a.out/852
CPU: 7 PID: 852 Comm: a.out Not tainted 5.18.0-rc7-dirty #66
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-1.fc33 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0x34/0x44
kasan_report+0xab/0x120
? nfsd_mkdir+0x71/0x1c0 [nfsd]
? nfsd_fill_super+0xc6/0xe0 [nfsd]
nfsd_fill_super+0xc6/0xe0 [nfsd]
? nfsd_mkdir+0x1c0/0x1c0 [nfsd]
get_tree_keyed+0x8e/0x100
vfs_get_tree+0x41/0xf0
__do_sys_fsconfig+0x590/0x670
? fscontext_read+0x180/0x180
? anon_inode_getfd+0x4f/0x70
do_syscall_64+0x35/0x80
entry_SYSCALL_64_after_hwframe+0x44/0xae
This can be reproduce by concurrent operations:
1. fsopen(nfsd)/fsconfig
2. insmod/rmmod nfsd
Since the nfsd file system is registered before than nfsd_net allocated,
the caller may get the file_system_type and use the nfsd_net before it
allocated, then null-ptr-deref occurred.
So init_nfsd() should call register_filesystem() last.
Fixes: bd5ae9288d64 ("nfsd: register pernet ops last, unregister first")
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'fs/cifs/smbdirect.h')
0 files changed, 0 insertions, 0 deletions