1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/fs/nilfs2
Nikita Zhandarovich 6438ef381c nilfs2: fix possible int overflows in nilfs_fiemap()
Since nilfs_bmap_lookup_contig() in nilfs_fiemap() calculates its result
by being prepared to go through potentially maxblocks == INT_MAX blocks,
the value in n may experience an overflow caused by left shift of blkbits.

While it is extremely unlikely to occur, play it safe and cast right hand
expression to wider type to mitigate the issue.

Found by Linux Verification Center (linuxtesting.org) with static analysis
tool SVACE.

Link: https://lkml.kernel.org/r/20250124222133.5323-1-konishi.ryusuke@gmail.com
Fixes: 622daaff0a ("nilfs2: fiemap support")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-02-01 03:53:26 -08:00
..
alloc.c nilfs2: add missing return value kernel-doc descriptions 2025-01-24 22:47:25 -08:00
alloc.h nilfs2: add missing return value kernel-doc descriptions 2025-01-24 22:47:25 -08:00
bmap.c nilfs2: correct return value kernel-doc descriptions for bmap functions 2025-01-24 22:47:25 -08:00
bmap.h nilfs2: use the BITS_PER_LONG macro 2024-09-01 20:43:42 -07:00
btnode.c nilfs2: revise the return value description style for consistency. 2025-01-24 22:47:25 -08:00
btnode.h fs/nilfs2: Use the enum req_op and blk_opf_t types 2022-07-14 12:14:33 -06:00
btree.c nilfs2: correct return value kernel-doc descriptions for bmap functions 2025-01-24 22:47:25 -08:00
btree.h nilfs2: add missing description of nilfs_btree_path structure 2024-09-01 20:43:36 -07:00
cpfile.c nilfs2: revise the return value description style for consistency. 2025-01-24 22:47:25 -08:00
cpfile.h nilfs2: remove nilfs_cpfile_{get,put}_checkpoint() 2024-02-22 15:38:53 -08:00
dat.c nilfs2: revise the return value description style for consistency. 2025-01-24 22:47:25 -08:00
dat.h nilfs2: remove filenames from file comments 2021-11-09 10:02:52 -08:00
dir.c nilfs2: handle errors that nilfs_prepare_chunk() may return 2025-01-24 22:47:25 -08:00
direct.c nilfs2: fix failure to detect DAT corruption in btree and direct mappings 2024-03-14 09:17:29 -07:00
direct.h nilfs2: remove filenames from file comments 2021-11-09 10:02:52 -08:00
export.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
file.c nilfs2: fix hang in nilfs_lookup_dirty_data_buffers() 2024-02-07 21:20:36 -08:00
gcinode.c nilfs2: correct return value kernel-doc descriptions for the rest 2025-01-24 22:47:25 -08:00
ifile.c nilfs2: revise the return value description style for consistency. 2025-01-24 22:47:25 -08:00
ifile.h nilfs2: convert inode file to be folio-based 2024-11-05 17:12:38 -08:00
inode.c nilfs2: fix possible int overflows in nilfs_fiemap() 2025-02-01 03:53:26 -08:00
ioctl.c nilfs2: revise the return value description style for consistency. 2025-01-24 22:47:25 -08:00
Kconfig fs: add CONFIG_BUFFER_HEAD 2023-08-02 09:13:09 -06:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mdt.c nilfs2: add missing return value kernel-doc descriptions 2025-01-24 22:47:25 -08:00
mdt.h nilfs2: fix lockdep warnings during disk space reclamation 2022-04-01 11:46:09 -07:00
namei.c nilfs2: do not update mtime of renamed directory that is not moved 2025-01-24 22:47:26 -08:00
nilfs.h nilfs2: handle errors that nilfs_prepare_chunk() may return 2025-01-24 22:47:25 -08:00
page.c nilfs2: add missing return value kernel-doc descriptions 2025-01-24 22:47:25 -08:00
page.h nilfs2: convert nilfs_page_count_clean_buffers() to take a folio 2024-11-05 17:12:39 -08:00
recovery.c nilfs2: add missing return value kernel-doc descriptions 2025-01-24 22:47:25 -08:00
segbuf.c nilfs2: correct return value kernel-doc descriptions for the rest 2025-01-24 22:47:25 -08:00
segbuf.h nilfs2: remove filenames from file comments 2021-11-09 10:02:52 -08:00
segment.c nilfs2: revise the return value description style for consistency. 2025-01-24 22:47:25 -08:00
segment.h nilfs2: use kthread_create and kthread_stop for the log writer thread 2024-09-01 20:43:44 -07:00
sufile.c nilfs2: revise the return value description style for consistency. 2025-01-24 22:47:25 -08:00
sufile.h nilfs2: add missing return value kernel-doc descriptions 2025-01-24 22:47:25 -08:00
super.c nilfs2: add missing return value kernel-doc descriptions 2025-01-24 22:47:25 -08:00
sysfs.c nilfs2: protect references to superblock parameters exposed in sysfs 2024-09-01 17:59:00 -07:00
sysfs.h nilfs2: remove filenames from file comments 2021-11-09 10:02:52 -08:00
the_nilfs.c nilfs2: add missing return value kernel-doc descriptions 2025-01-24 22:47:25 -08:00
the_nilfs.h nilfs2: eliminate the shared counter and spinlock for i_generation 2024-09-01 20:43:43 -07:00