ext4: fix check for block being out of directory size
authorJan Kara <jack@suse.cz>
Mon, 22 Aug 2022 11:48:32 +0000 (13:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 10:34:29 +0000 (12:34 +0200)
commitdd366295d1eca557e7a9000407ec3952f691d27b
treeaedbebf662ca2075f70cc39ec1c7d83bf71f65ad
parent4a967fe8b0438c73ec738dfa8a4dbb56b6523217
ext4: fix check for block being out of directory size

commit 61a1d87a324ad5e3ed27c6699dfc93218fcf3201 upstream.

The check in __ext4_read_dirblock() for block being outside of directory
size was wrong because it compared block number against directory size
in bytes. Fix it.

Fixes: 65f8ea4cd57d ("ext4: check if directory block is within i_size")
CVE: CVE-2022-1184
CC: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Link: https://lore.kernel.org/r/20220822114832.1482-1-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