]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
quota: check block number when reading the block in quota file
authorZhang Yi <yi.zhang@huawei.com>
Fri, 8 Oct 2021 09:38:20 +0000 (17:38 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Nov 2021 10:36:03 +0000 (11:36 +0100)
commite5222c87dc441dcc8a66e93cb3fd34dfff03d3ec
tree1f38c01f40061236212d336dd80bbb57d3d4a78c
parentc49c974429c965586451d039d266290c2ac39996
quota: check block number when reading the block in quota file

commit 9bf3d20331295b1ecb81f4ed9ef358c51699a050 upstream.

The block number in the quota tree on disk should be smaller than the
v2_disk_dqinfo.dqi_blocks. If the quota file was corrupted, we may be
allocating an 'allocated' block and that would lead to a loop in a tree,
which will probably trigger oops later. This patch adds a check for the
block number in the quota tree to prevent such potential issue.

Link: https://lore.kernel.org/r/20211008093821.1001186-2-yi.zhang@huawei.com
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Cc: stable@kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/quota/quota_tree.c