linux/fs/ntfs
Hawkins Jiawei 63095f4f3a ntfs: check overflow when iterating ATTR_RECORDs
Kernel iterates over ATTR_RECORDs in mft record in ntfs_attr_find(). 
Because the ATTR_RECORDs are next to each other, kernel can get the next
ATTR_RECORD from end address of current ATTR_RECORD, through current
ATTR_RECORD length field.

The problem is that during iteration, when kernel calculates the end
address of current ATTR_RECORD, kernel may trigger an integer overflow bug
in executing `a = (ATTR_RECORD*)((u8*)a + le32_to_cpu(a->length))`.  This
may wrap, leading to a forever iteration on 32bit systems.

This patch solves it by adding some checks on calculating end address
of current ATTR_RECORD during iteration.

Link: https://lkml.kernel.org/r/20220831160935.3409-4-yin31149@gmail.com
Link: https://lore.kernel.org/all/20220827105842.GM2030@kadam/
Signed-off-by: Hawkins Jiawei <yin31149@gmail.com>
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Anton Altaparmakov <anton@tuxera.com>
Cc: chenxiaosong (A) <chenxiaosong2@huawei.com>
Cc: syzkaller-bugs <syzkaller-bugs@googlegroups.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2022-09-11 21:55:12 -07:00
..
aops.c Folio changes for 6.0 2022-08-03 10:35:43 -07:00
aops.h ntfs: Remove check for PageError 2022-06-29 08:51:07 -04:00
attrib.c ntfs: check overflow when iterating ATTR_RECORDs 2022-09-11 21:55:12 -07:00
attrib.h
bitmap.c
bitmap.h
collate.c
collate.h
compress.c fs/buffer: Combine two submit_bh() and ll_rw_block() arguments 2022-07-14 12:14:32 -06:00
debug.c
debug.h
dir.c ntfs: fix ntfs_test_inode and ntfs_init_locked_inode function type 2020-08-07 11:33:21 -07:00
dir.h
endian.h
file.c Folio changes for 6.0 2022-08-03 10:35:43 -07:00
index.c
index.h
inode.c ntfs: fix use-after-free in ntfs_attr_find() 2022-09-11 21:55:11 -07:00
inode.h fs: make helpers idmap mount aware 2021-01-24 14:27:20 +01:00
Kconfig fs: ntfs: Limit NTFS_RW to page sizes smaller than 64k 2021-11-27 14:34:41 -08:00
layout.h ntfs: layout.h: delete duplicated words 2021-02-24 13:38:26 -08:00
lcnalloc.c
lcnalloc.h
logfile.c fs/buffer: Combine two submit_bh() and ll_rw_block() arguments 2022-07-14 12:14:32 -06:00
logfile.h
Makefile
malloc.h mm: remove the pgprot argument to __vmalloc 2020-06-02 10:59:11 -07:00
mft.c fs/buffer: Combine two submit_bh() and ll_rw_block() arguments 2022-07-14 12:14:32 -06:00
mft.h ntfs: Convert ntfs to read_folio 2022-05-09 16:21:46 -04:00
mst.c
namei.c
ntfs.h
quota.c
quota.h
runlist.c
runlist.h
super.c ntfs: use sb_bdev_nr_blocks 2021-10-18 14:43:23 -06:00
sysctl.c
sysctl.h
time.h
types.h
unistr.c
upcase.c
usnjrnl.c
usnjrnl.h
volume.h