From: Lukas Czerner <lczerner@redhat.com>
To: Jan Kara <jack@suse.cz>
Cc: Ted Tso <tytso@mit.edu>,
linux-ext4@vger.kernel.org,
Salvatore Bonaccorso <carnil@debian.org>,
stable@vger.kernel.org
Subject: Re: [PATCH] ext4: Fix check for block being out of directory size
Date: Tue, 23 Aug 2022 12:00:19 +0200 [thread overview]
Message-ID: <20220823100019.wukhx7a6bul4isjl@fedora> (raw)
In-Reply-To: <20220822114832.1482-1-jack@suse.cz>
On Mon, Aug 22, 2022 at 01:48:32PM +0200, Jan Kara wrote:
> 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.
Good catch, thanks!
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
>
> 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>
> ---
> fs/ext4/namei.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index 3a31b662f661..bc2e0612ec32 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -126,7 +126,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);
> --
> 2.35.3
>
next prev parent reply other threads:[~2022-08-23 12:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-22 11:48 [PATCH] ext4: Fix check for block being out of directory size Jan Kara
2022-08-23 10:00 ` Lukas Czerner [this message]
2022-08-31 19:31 ` Salvatore Bonaccorso
2022-09-29 14:58 ` Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220823100019.wukhx7a6bul4isjl@fedora \
--to=lczerner@redhat.com \
--cc=carnil@debian.org \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox