]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ext4: avoid cycles in directory h-tree
authorJan Kara <jack@suse.cz>
Wed, 18 May 2022 09:33:29 +0000 (11:33 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jun 2022 14:59:27 +0000 (16:59 +0200)
commitb3ad9ff6f06c1dc6abf7437691c88ca3d6da3ac0
tree697fa24e90876b0708fc96219964bf3f6fae3fc6
parent78398c2b2cc14f9a9c8592cf6d334c5a479ed611
ext4: avoid cycles in directory h-tree

commit 3ba733f879c2a88910744647e41edeefbc0d92b2 upstream.

A maliciously corrupted filesystem can contain cycles in the h-tree
stored inside a directory. That can easily lead to the kernel corrupting
tree nodes that were already verified under its hands while doing a node
split and consequently accessing unallocated memory. Fix the problem by
verifying traversed block numbers are unique.

Cc: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20220518093332.13986-2-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/namei.c