ext4: Verify extent header in ext4_find_extent()
PATCH 1/1 ext4: Verify extent header in ext4_find_extent()
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.
--- fs/ext4/extents.c | 3 +++ 1 file changed, 3 insertions(+)
fs/ext4/extents.c +3 -0
@@ -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);
Signature · 1 line
2.38.1
Quoted 17 lines · Shigeru Yoshida
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 [email protected]Signed-off-by Shigeru Yoshida <[email protected]>--- fs/ext4/extents.c | 3 +++ 1 file changed, 3 insertions(+)fs/ext4/extents.c +0
-0
fs/ext4/extents.c ext4_find_extent(struct inode *inode, ext4_lblk_t block, · line 906
Quoted 6 lines
fs/ext4/extents.c +3
-0@@ -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/[email protected]/T/#u
- Eric
Quoted 13 lines · Eric Biggers
Quoted 12 lines · Shigeru Yoshida
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 [email protected]Signed-off-by Shigeru Yoshida <[email protected]>--- fs/ext4/extents.c | 3 +++ 1 file changed, 3 insertions(+)
Quoted 15 lines
fs/ext4/extents.c ext4_find_extent(struct inode *inode, ext4_lblk_t block, · line 906
Quoted 11 lines
fs/ext4/extents.c +3
-0@@ -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/[email protected]/T/#u
Thank you so much for your comment!! I missed the discussion you mentioned. I'll check that.
Regards,
Shigeru
Quoted 3 lines
- Eric