linux-stable/fs/ntfs3
Randy Dunlap 58cf68a188 fs/ntfs3: validate BOOT sectors_per_clusters
commit a3b774342f upstream.

When the NTFS BOOT sectors_per_clusters field is > 0x80, it represents a
shift value.  Make sure that the shift value is not too large before using
it (NTFS max cluster size is 2MB).  Return -EVINVAL if it too large.

This prevents negative shift values and shift values that are larger than
the field size.

Prevents this UBSAN error:

 UBSAN: shift-out-of-bounds in ../fs/ntfs3/super.c:673:16
 shift exponent -192 is negative

Link: https://lkml.kernel.org/r/20220502175342.20296-1-rdunlap@infradead.org
Fixes: 82cae269cf ("fs/ntfs3: Add initialization of super block")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: syzbot+1631f09646bc214d2e76@syzkaller.appspotmail.com
Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
Cc: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Kari Argillander <kari.argillander@stargateuniverse.net>
Cc: Namjae Jeon <linkinjeon@kernel.org>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-06 08:43:40 +02:00
..
lib fs/ntfs3: Add missing header and guards to lib/ headers 2021-09-13 19:41:44 +03:00
attrib.c fs/ntfs3: Keep prealloc for all types of files 2021-10-11 19:10:19 +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: Use min/max macros instated of ternary operators 2021-09-16 17:01:37 +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 iov_iter: Turn iov_iter_fault_in_readable into fault_in_iov_iter_readable 2022-05-01 17:22:28 +02:00
frecord.c fs/ntfs3: Check for NULL pointers in ni_try_remove_attr_list 2021-10-12 18:53:03 +03:00
fslog.c fs/ntfs3: Add sync flag to ntfs_sb_write_run and al_update 2021-09-21 18:37:01 +03:00
fsntfs.c fs/ntfs3: Add sync flag to ntfs_sb_write_run and al_update 2021-09-21 18:37:01 +03:00
index.c fs/ntfs3: Remove a useless test in 'indx_find()' 2021-09-23 19:05:25 +03:00
inode.c fs/ntfs3: Refactor ntfs_read_mft 2021-10-11 19:28:06 +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.h fs/ntfs3: Change max hardlinks limit to 4000 2021-09-21 18:37:01 +03:00
ntfs_fs.h Fixed xfstests generic/016 generic/021 generic/022 generic/041 generic/274 generic/423, 2021-10-15 09:58:11 -04:00
record.c fs/ntfs3: Remove unneeded header files from c files 2021-09-13 19:41:46 +03:00
run.c fs/ntfs3: Remove unneeded header files from c files 2021-09-13 19:41:46 +03:00
super.c fs/ntfs3: validate BOOT sectors_per_clusters 2022-06-06 08:43:40 +02:00
upcase.c fs/ntfs3: Change right headers to upcase.c 2021-09-13 19:41:45 +03:00
xattr.c Fixed xfstests generic/016 generic/021 generic/022 generic/041 generic/274 generic/423, 2021-10-15 09:58:11 -04:00