Message ID | 20230517161227.141529-2-cengiz.can@canonical.com |
---|---|
State | New |
Headers | show |
Series | CVE-2022-1184 | expand |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index c71a1533404a..f8faf6d742cd 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -123,6 +123,13 @@ 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) { + ext4_error_inode(inode, func, line, block, + "Attempting to read directory block (%u) that is past i_size (%llu)", + block, inode->i_size); + return ERR_PTR(-EFSCORRUPTED); + } + bh = ext4_bread(NULL, inode, block, 0); if (IS_ERR(bh)) { __ext4_warning(inode->i_sb, func, line,