f2fs: avoid out-of-range memory access
authorOcean Chen <oceanchen@google.com>
Mon, 8 Jul 2019 04:34:56 +0000 (12:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Aug 2019 07:33:41 +0000 (09:33 +0200)
commitdd1fc2ce32f0b58b15d5c727d237bd8684310735
tree22a70d9aa38faded64ff87aea34c08d4c43417a4
parent34dd8fb9b8ff63629e4ea910a11546db43f85456
f2fs: avoid out-of-range memory access

[ Upstream commit 56f3ce675103e3fb9e631cfb4131fc768bc23e9a ]

blkoff_off might over 512 due to fs corrupt or security
vulnerability. That should be checked before being using.

Use ENTRIES_IN_SUM to protect invalid value in cur_data_blkoff.

Signed-off-by: Ocean Chen <oceanchen@google.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/segment.c