* [PATCH] ext4: Verify extent header in ext4_find_extent()
@ 2023-01-02 14:58 Shigeru Yoshida
2023-01-02 23:10 ` Eric Biggers
0 siblings, 1 reply; 3+ messages in thread
From: Shigeru Yoshida @ 2023-01-02 14:58 UTC (permalink / raw)
To: tytso, adilger.kernel
Cc: linux-ext4, linux-kernel, Shigeru Yoshida, syzbot+bf4bb7731ef73b83a3b4
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;
if (path) {
ext4_ext_drop_refs(path);
--
2.38.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ext4: Verify extent header in ext4_find_extent()
2023-01-02 14:58 [PATCH] ext4: Verify extent header in ext4_find_extent() Shigeru Yoshida
@ 2023-01-02 23:10 ` Eric Biggers
2023-01-03 17:33 ` Shigeru Yoshida
0 siblings, 1 reply; 3+ messages in thread
From: Eric Biggers @ 2023-01-02 23:10 UTC (permalink / raw)
To: Shigeru Yoshida
Cc: tytso, adilger.kernel, linux-ext4, linux-kernel,
syzbot+bf4bb7731ef73b83a3b4
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ext4: Verify extent header in ext4_find_extent()
2023-01-02 23:10 ` Eric Biggers
@ 2023-01-03 17:33 ` Shigeru Yoshida
0 siblings, 0 replies; 3+ messages in thread
From: Shigeru Yoshida @ 2023-01-03 17:33 UTC (permalink / raw)
To: Eric Biggers
Cc: tytso, adilger.kernel, linux-ext4, linux-kernel,
syzbot+bf4bb7731ef73b83a3b4
On Mon, Jan 02, 2023 at 03:10:19PM -0800, Eric Biggers wrote:
> 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
Thank you so much for your comment!! I missed the discussion you
mentioned. I'll check that.
Regards,
Shigeru
>
> - Eric
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-01-03 17:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-02 14:58 [PATCH] ext4: Verify extent header in ext4_find_extent() Shigeru Yoshida
2023-01-02 23:10 ` Eric Biggers
2023-01-03 17:33 ` Shigeru Yoshida
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.