linux-stable/fs/ntfs3
Zeng Heng 721b75ea2d ntfs: Fix panic about slab-out-of-bounds caused by ntfs_listxattr()
[ Upstream commit 3c675ddffb ]

Here is a BUG report from syzbot:

BUG: KASAN: slab-out-of-bounds in ntfs_list_ea fs/ntfs3/xattr.c:191 [inline]
BUG: KASAN: slab-out-of-bounds in ntfs_listxattr+0x401/0x570 fs/ntfs3/xattr.c:710
Read of size 1 at addr ffff888021acaf3d by task syz-executor128/3632

Call Trace:
 ntfs_list_ea fs/ntfs3/xattr.c:191 [inline]
 ntfs_listxattr+0x401/0x570 fs/ntfs3/xattr.c:710
 vfs_listxattr fs/xattr.c:457 [inline]
 listxattr+0x293/0x2d0 fs/xattr.c:804

Fix the logic of ea_all iteration. When the ea->name_len is 0,
return immediately, or Add2Ptr() would visit invalid memory
in the next loop.

Fixes: be71b5cba2 ("fs/ntfs3: Add attrib operations")
Reported-by: syzbot+9fcea5ef6dc4dc72d334@syzkaller.appspotmail.com
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
[almaz.alexandrovich@paragon-software.com: lines of the patch have changed]
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-07-19 16:36:46 +02:00
..
lib fs/ntfs3: Add missing header and guards to lib/ headers 2021-09-13 19:41:44 +03:00
Kconfig fs: build the legacy direct I/O code conditionally 2023-01-26 10:30:56 -07:00
Makefile
attrib.c fs/ntfs3: Code formatting and refactoring 2023-03-27 17:44:35 +04:00
attrlist.c fs/ntfs3: Validate data run offset 2022-09-30 17:39:49 +03:00
bitfunc.c fs/ntfs3: Add ntfs_bitmap_weight_le function and refactoring 2022-11-14 19:50:42 +03:00
bitmap.c fs/ntfs3: Code formatting and refactoring 2023-03-27 17:44:35 +04: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: Fix sparse problems 2022-11-14 19:50:42 +03:00
file.c fs/ntfs3: Code formatting and refactoring 2023-03-27 17:44:35 +04:00
frecord.c fs/ntfs3: Print details about mount fails 2023-03-27 17:44:36 +04:00
fslog.c fs/ntfs3: Code formatting and refactoring 2023-03-27 17:44:35 +04:00
fsntfs.c fs/ntfs3: Print details about mount fails 2023-03-27 17:44:36 +04:00
index.c fs/ntfs3: Code formatting and refactoring 2023-03-27 17:44:35 +04:00
inode.c fs/ntfs3: Code formatting and refactoring 2023-03-27 17:44:35 +04:00
lznt.c fs/ntfs3: Code formatting and refactoring 2023-03-27 17:44:35 +04:00
namei.c fs/ntfs3: Code formatting and refactoring 2023-03-27 17:44:35 +04:00
ntfs.h fs/ntfs3: Refactoring of various minor issues 2023-03-27 16:59:16 +04:00
ntfs_fs.h fs/ntfs3: Code formatting and refactoring 2023-03-27 17:44:35 +04:00
record.c fs/ntfs3: Code formatting and refactoring 2023-03-27 17:44:35 +04:00
run.c fs/ntfs3: Code formatting and refactoring 2023-03-27 17:44:35 +04:00
super.c fs/ntfs3: Fix root inode checking 2023-03-27 17:44:37 +04:00
upcase.c fs/ntfs3: Add option "nocase" 2022-09-30 17:39:47 +03:00
xattr.c ntfs: Fix panic about slab-out-of-bounds caused by ntfs_listxattr() 2023-07-19 16:36:46 +02:00