linux/fs/ntfs3
Pavel Skripkin 321460ca3b
fs/ntfs3: Fix NULL deref in ntfs_update_mftmirr
If ntfs_fill_super() wasn't called then sbi->sb will be equal to NULL.
Code should check this ptr before dereferencing. Syzbot hit this issue
via passing wrong mount param as can be seen from log below

Fail log:
ntfs3: Unknown parameter 'iochvrset'
general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f]
CPU: 1 PID: 3589 Comm: syz-executor210 Not tainted 5.18.0-rc3-syzkaller-00016-gb253435746d9 #0
...
Call Trace:
 <TASK>
 put_ntfs+0x1ed/0x2a0 fs/ntfs3/super.c:463
 ntfs_fs_free+0x6a/0xe0 fs/ntfs3/super.c:1363
 put_fs_context+0x119/0x7a0 fs/fs_context.c:469
 do_new_mount+0x2b4/0xad0 fs/namespace.c:3044
 do_mount fs/namespace.c:3383 [inline]
 __do_sys_mount fs/namespace.c:3591 [inline]

Fixes: 82cae269cf ("fs/ntfs3: Add initialization of super block")
Reported-and-tested-by: syzbot+c95173762127ad76a824@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
2022-07-05 16:07:46 +03:00
..
lib fs/ntfs3: Add missing header and guards to lib/ headers 2021-09-13 19:41:44 +03:00
attrib.c fs/ntfs3: Fallocate (FALLOC_FL_INSERT_RANGE) implementation 2022-06-28 18:51:06 +03:00
attrlist.c fs/ntfs3: Add sync flag to ntfs_sb_write_run and al_update 2021-09-21 18:37:01 +03:00
bitfunc.c fs/ntfs3: Remove a useless shadowing variable 2021-09-23 19:05:46 +03:00
bitmap.c fs/ntfs3: Remove a useless test 2022-06-07 19:40:14 +03:00
debug.h fs/ntfs3. Add forward declarations for structs to debug.h 2021-09-13 19:41:43 +03:00
dir.c fs/ntfs3: Rework ntfs_utf16_to_nls 2021-10-11 19:28:04 +03:00
file.c fs/ntfs3: Enable FALLOC_FL_INSERT_RANGE 2022-06-28 18:51:12 +03:00
frecord.c fs/ntfs3: Refactor ni_try_remove_attr_list function 2022-06-06 18:38:57 +03:00
fslog.c fs/ntfs3: Add missing error check 2022-06-17 19:18:29 +03:00
fsntfs.c fs/ntfs3: Fix NULL deref in ntfs_update_mftmirr 2022-07-05 16:07:46 +03:00
index.c fs/ntfs3: Fix using uninitialized value n when calling indx_read 2022-06-09 19:16:08 +03:00
inode.c fs/ntfs3: Fix missing i_op in ntfs_read_mft 2022-06-06 18:38:58 +03:00
Kconfig
lznt.c fs/ntfs3: Remove tabs before spaces from comment 2021-09-16 17:01:36 +03:00
Makefile
namei.c fs/ntfs3: Move ni_lock_dir and ni_unlock into ntfs_create_inode 2021-09-24 17:39:57 +03:00
ntfs_fs.h fs/ntfs3: Fallocate (FALLOC_FL_INSERT_RANGE) implementation 2022-06-28 18:51:06 +03:00
ntfs.h fs/ntfs3: Change max hardlinks limit to 4000 2021-09-21 18:37:01 +03:00
record.c fs/ntfs3: Refactor ni_try_remove_attr_list function 2022-06-06 18:38:57 +03:00
run.c fs/ntfs3: Fallocate (FALLOC_FL_INSERT_RANGE) implementation 2022-06-28 18:51:06 +03:00
super.c fs/ntfs3: Fix double free on remount 2022-06-06 18:38:57 +03:00
upcase.c fs/ntfs3: Change right headers to upcase.c 2021-09-13 19:41:45 +03:00
xattr.c fs/ntfs3: Use the same order for acl pointer check in ntfs_init_acl 2022-06-09 19:16:18 +03:00