aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorWei Fang <fangwei1@huawei.com>2017-01-22 12:21:02 +0800
committerMister Oyster <oysterized@gmail.com>2017-04-13 12:34:47 +0200
commit07e64b221d945ebea2052835cea6afbffa1af5b2 (patch)
treeb41e569e816394ed1752f4f765e4a8b068ed2c97 /scripts
parent3d9cd41d23b3424c4359b6187bac5689e8075b80 (diff)
f2fs: fix a dead loop in f2fs_fiemap()
A dead loop can be triggered in f2fs_fiemap() using the test case as below: ... fd = open(); fallocate(fd, 0, 0, 4294967296); ioctl(fd, FS_IOC_FIEMAP, fiemap_buf); ... It's caused by an overflow in __get_data_block(): ... bh->b_size = map.m_len << inode->i_blkbits; ... map.m_len is an unsigned int, and bh->b_size is a size_t which is 64 bits on 64 bits archtecture, type conversion from an unsigned int to a size_t will result in an overflow. In the above-mentioned case, bh->b_size will be zero, and f2fs_fiemap() will call get_data_block() at block 0 again an again. Fix this by adding a force conversion before left shift. Signed-off-by: Wei Fang <fangwei1@huawei.com> Acked-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions