ext4: fix potential out of bound read in ext4_fc_replay_scan()
authorEric Biggers <ebiggers@kernel.org>
Thu, 5 Jan 2023 07:13:54 +0000 (23:13 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2023 10:59:04 +0000 (11:59 +0100)
commit6969367c1500c15eddc38fda12f6d15518ad6d03
treee5bfb0eb66e06117a6cfda60c6380cc6b8b39168
parent818175ae3bd2ca1af5a3950b4c062898e2e92a1f
ext4: fix potential out of bound read in ext4_fc_replay_scan()

From: Ye Bin <yebin10@huawei.com>

commit 1b45cc5c7b920fd8bf72e5a888ec7abeadf41e09 upstream.

For scan loop must ensure that at least EXT4_FC_TAG_BASE_LEN space. If remain
space less than EXT4_FC_TAG_BASE_LEN which will lead to out of bound read
when mounting corrupt file system image.
ADD_RANGE/HEAD/TAIL is needed to add extra check when do journal scan, as this
three tags will read data during scan, tag length couldn't less than data length
which will read.

Cc: stable@kernel.org
Signed-off-by: Ye Bin <yebin10@huawei.com>
Link: https://lore.kernel.org/r/20220924075233.2315259-4-yebin10@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/fast_commit.c