linux-stable/fs/ntfs3
Zeng Heng c58ea97aa9 fs/ntfs3: Fix slab-out-of-bounds read in hdr_delete_de()
[ Upstream commit ab84eee4c7 ]

Here is a BUG report from syzbot:

BUG: KASAN: slab-out-of-bounds in hdr_delete_de+0xe0/0x150 fs/ntfs3/index.c:806
Read of size 16842960 at addr ffff888079cc0600 by task syz-executor934/3631

Call Trace:
 memmove+0x25/0x60 mm/kasan/shadow.c:54
 hdr_delete_de+0xe0/0x150 fs/ntfs3/index.c:806
 indx_delete_entry+0x74f/0x3670 fs/ntfs3/index.c:2193
 ni_remove_name+0x27a/0x980 fs/ntfs3/frecord.c:2910
 ntfs_unlink_inode+0x3d4/0x720 fs/ntfs3/inode.c:1712
 ntfs_rename+0x41a/0xcb0 fs/ntfs3/namei.c:276

Before using the meta-data in struct INDEX_HDR, we need to
check index header valid or not. Otherwise, the corruptedi
(or malicious) fs image can cause out-of-bounds access which
could make kernel panic.

Fixes: 82cae269cf ("fs/ntfs3: Add initialization of super block")
Reported-by: syzbot+9c2811fd56591639ff5f@syzkaller.appspotmail.com
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-05-11 23:00:36 +09:00
..
lib fs/ntfs3: Add missing header and guards to lib/ headers 2021-09-13 19:41:44 +03:00
attrib.c fs/ntfs3: Fix attr_punch_hole() null pointer derenference 2023-01-24 07:22:48 +01:00
attrlist.c fs/ntfs3: Validate data run offset 2023-01-12 11:58:43 +01:00
bitfunc.c fs/ntfs3: Remove a useless shadowing variable 2021-09-23 19:05:46 +03:00
bitmap.c fs/ntfs3: Use __GFP_NOWARN allocation at wnd_init() 2023-01-12 11:58:45 +01: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: don't hold ni_lock when calling truncate_setsize() 2023-01-12 11:59:15 +01:00
frecord.c fs/ntfs3: Validate data run offset 2023-01-12 11:58:43 +01:00
fslog.c fs/ntfs3: Fix slab-out-of-bounds read in hdr_delete_de() 2023-05-11 23:00:36 +09:00
fsntfs.c fs/ntfs3: Validate index root when initialize NTFS security 2023-01-12 11:58:45 +01:00
index.c fs/ntfs3: Fix slab-out-of-bounds read in hdr_delete_de() 2023-05-11 23:00:36 +09:00
inode.c fs/ntfs3: Fix memory leak if ntfs_read_mft failed 2023-05-11 23:00:35 +09: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.h fs/ntfs3: Change max hardlinks limit to 4000 2021-09-21 18:37:01 +03:00
ntfs_fs.h fs/ntfs3: Fix slab-out-of-bounds read in hdr_delete_de() 2023-05-11 23:00:36 +09:00
record.c fs/ntfs3: Validate resident attribute name 2023-01-12 11:58:44 +01:00
run.c fs/ntfs3: Remove unneeded header files from c files 2021-09-13 19:41:46 +03:00
super.c fs/ntfs3: Use __GFP_NOWARN allocation at ntfs_fill_super() 2023-01-12 11:58:45 +01:00
upcase.c fs/ntfs3: Change right headers to upcase.c 2021-09-13 19:41:45 +03:00
xattr.c fs/ntfs3: Harden against integer overflows 2022-12-31 13:14:33 +01:00