diff options
author | Jan Kara <jack@suse.cz> | 2022-08-22 14:48:32 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-10-26 14:25:13 +0300 |
commit | 483831ad0440f62c10d1707c97ce824bd82d98ae (patch) | |
tree | 2559ac218fad41fda27a6fd2bc5dfe280bc2f383 /fs/ext4 | |
parent | ac66db1a436504159463f811b9e9864c1d2b03f1 (diff) | |
download | linux-483831ad0440f62c10d1707c97ce824bd82d98ae.tar.xz |
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>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/namei.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 58b0f1b12095..646cc1935dff 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -125,7 +125,7 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode, struct ext4_dir_entry *dirent; int is_dx_block = 0; - if (block >= inode->i_size) { + if (block >= inode->i_size >> inode->i_blkbits) { ext4_error_inode(inode, func, line, block, "Attempting to read directory block (%u) that is past i_size (%llu)", block, inode->i_size); |