linux-stable/fs/ntfs3
Yin Xiujiang 6d076293e5 fs/ntfs3: Fix slab-out-of-bounds in r_page
[ Upstream commit ecfbd57cf9 ]

When PAGE_SIZE is 64K, if read_log_page is called by log_read_rst for
the first time, the size of *buffer would be equal to
DefaultLogPageSize(4K).But for *buffer operations like memcpy,
if the memory area size(n) which being assigned to buffer is larger
than 4K (log->page_size(64K) or bytes(64K-page_off)), it will cause
an out of boundary error.
 Call trace:
  [...]
  kasan_report+0x44/0x130
  check_memory_region+0xf8/0x1a0
  memcpy+0xc8/0x100
  ntfs_read_run_nb+0x20c/0x460
  read_log_page+0xd0/0x1f4
  log_read_rst+0x110/0x75c
  log_replay+0x1e8/0x4aa0
  ntfs_loadlog_and_replay+0x290/0x2d0
  ntfs_fill_super+0x508/0xec0
  get_tree_bdev+0x1fc/0x34c
  [...]

Fix this by setting variable r_page to NULL in log_read_rst.

Signed-off-by: Yin Xiujiang <yinxiujiang@kylinos.cn>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-01-04 11:28:57 +01:00
..
lib fs/ntfs3: Add missing header and guards to lib/ headers 2021-09-13 19:41:44 +03:00
attrib.c fs/ntfs3: Add null pointer check to attr_load_runs_vcn 2023-01-04 11:28:54 +01:00
attrlist.c fs/ntfs3: Validate data run offset 2023-01-04 11:28:54 +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-04 11:28:57 +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 ntfs3 for 6.0 2022-08-17 14:51:22 -07:00
frecord.c fs/ntfs3: Validate data run offset 2023-01-04 11:28:54 +01:00
fslog.c fs/ntfs3: Fix slab-out-of-bounds in r_page 2023-01-04 11:28:57 +01:00
fsntfs.c fs/ntfs3: Validate index root when initialize NTFS security 2023-01-04 11:28:57 +01:00
index.c fs/ntfs3: Validate buffer length while parsing index 2023-01-04 11:28:56 +01:00
inode.c fs/ntfs3: Delete duplicate condition in ntfs_read_mft() 2023-01-04 11:28:57 +01: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: New function ntfs_bad_inode 2022-08-03 18:25:08 +03:00
ntfs.h fs/ntfs3: Change max hardlinks limit to 4000 2021-09-21 18:37:01 +03:00
ntfs_fs.h ntfs3 for 6.0 2022-08-17 14:51:22 -07:00
record.c fs/ntfs3: Validate resident attribute name 2023-01-04 11:28:56 +01:00
run.c fs/ntfs3: Refactoring attr_punch_hole to restore after errors 2022-08-03 18:25:09 +03:00
super.c fs/ntfs3: Use __GFP_NOWARN allocation at ntfs_fill_super() 2023-01-04 11:28:57 +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:32:46 +01:00