All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Shigeru Yoshida <syoshida@redhat.com>
Cc: tytso@mit.edu, adilger.kernel@dilger.ca,
	linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzbot+bf4bb7731ef73b83a3b4@syzkaller.appspotmail.com
Subject: Re: [PATCH] ext4: Verify extent header in ext4_find_extent()
Date: Mon, 2 Jan 2023 15:10:19 -0800	[thread overview]
Message-ID: <Y7NkW86aVcksg3i9@sol.localdomain> (raw)
In-Reply-To: <20230102145833.2758-1-syoshida@redhat.com>

On Mon, Jan 02, 2023 at 02:58:33PM +0000, Shigeru Yoshida wrote:
> syzbot reported use-after-free in ext4_find_extent() [1].  If there is
> a corrupted file system, this can cause invalid memory access.
> 
> This patch fixes the issue by verifying extent header.
> 
> Reported-by: syzbot+bf4bb7731ef73b83a3b4@syzkaller.appspotmail.com
> Link: https://syzkaller.appspot.com/bug?id=cd95cb722bfa1234ac4c78345c8953ee2e7170d0 [1]
> Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
> ---
>  fs/ext4/extents.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index 9de1c9d1a13d..79bfa583ab1d 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -901,6 +901,9 @@ ext4_find_extent(struct inode *inode, ext4_lblk_t block,
>  		ret = -EFSCORRUPTED;
>  		goto err;
>  	}
> +	ret = ext4_ext_check(inode, eh, depth, 0);
> +	if (ret)
> +		goto err;

This patch probably does not address the root cause of the problem.  Please see
the discussion on the very similar patch
https://lore.kernel.org/linux-ext4/20221230062931.2344157-1-tudor.ambarus@linaro.org/T/#u

- Eric

  reply	other threads:[~2023-01-02 23:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-02 14:58 [PATCH] ext4: Verify extent header in ext4_find_extent() Shigeru Yoshida
2023-01-02 23:10 ` Eric Biggers [this message]
2023-01-03 17:33   ` Shigeru Yoshida

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=Y7NkW86aVcksg3i9@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syoshida@redhat.com \
    --cc=syzbot+bf4bb7731ef73b83a3b4@syzkaller.appspotmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.