public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Salvatore Bonaccorso <carnil@debian.org>
To: Lukas Czerner <lczerner@redhat.com>
Cc: Jan Kara <jack@suse.cz>, Ted Tso <tytso@mit.edu>,
	linux-ext4@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] ext4: Fix check for block being out of directory size
Date: Wed, 31 Aug 2022 21:31:21 +0200	[thread overview]
Message-ID: <Yw+3CfOL6YtYKHZl@eldamar.lan> (raw)
In-Reply-To: <20220823100019.wukhx7a6bul4isjl@fedora>

Hi,

On Tue, Aug 23, 2022 at 12:00:19PM +0200, Lukas Czerner wrote:
> 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);

Ted, is this on your radar to get applied for mainline and to the
stable trees?

Regards,
Salvatore

  reply	other threads:[~2022-08-31 19:31 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
2022-08-31 19:31   ` Salvatore Bonaccorso [this message]
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=Yw+3CfOL6YtYKHZl@eldamar.lan \
    --to=carnil@debian.org \
    --cc=jack@suse.cz \
    --cc=lczerner@redhat.com \
    --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