* [PATCH] ext4: validate in-inode xattrs before listing
@ 2026-11-17 9:01 Haoli Zhang
2026-11-17 9:23 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Haoli Zhang @ 2026-11-17 9:01 UTC (permalink / raw)
To: tytso
Cc: adilger.kernel, libaokun, jack, ojaswin, ritesh.list, yi.zhang,
linux-ext4, linux-kernel, syzbot+3fbf2337de43f5581aec,
Haoli Zhang, Jinning Zhang, Bin Yu
ext4_iget() validates in-inode xattrs when it reads an inode. However,
ext4_xattr_ibody_list() fetches the inode-table data again with
ext4_get_inode_loc() and passes the entries to ext4_xattr_list_entries()
without validating this read. If the re-read data contains a malformed
xattr entry, the listing loop can advance beyond the valid in-inode xattr
area and read invalid memory.
Validate the in-inode xattrs from this read with xattr_check_inode()
before listing them. If validation fails, skip the listing and return the
error after releasing the inode-table buffer.
Reported-by: syzbot+3fbf2337de43f5581aec@syzkaller.appspotmail.com
Closes: https://syzbot.org/bug?extid=3fbf2337de43f5581aec
Co-developed-by: Jinning Zhang <25031212117@stu.xidian.edu.cn>
Signed-off-by: Jinning Zhang <25031212117@stu.xidian.edu.cn>
Co-developed-by: Bin Yu <byu@xidian.edu.cn>
Signed-off-by: Bin Yu <byu@xidian.edu.cn>
Signed-off-by: Haoli Zhang <26031212468@stu.xidian.edu.cn>
---
fs/ext4/xattr.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -790,9 +790,11 @@
return error;
raw_inode = ext4_raw_inode(&iloc);
header = IHDR(inode, raw_inode);
- error = ext4_xattr_list_entries(dentry, IFIRST(header),
- buffer, buffer_size);
+ error = xattr_check_inode(inode, header, ITAIL(inode, raw_inode));
+ if (!error)
+ error = ext4_xattr_list_entries(dentry, IFIRST(header),
+ buffer, buffer_size);
brelse(iloc.bh);
return error;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ext4: validate in-inode xattrs before listing
2026-11-17 9:01 [PATCH] ext4: validate in-inode xattrs before listing Haoli Zhang
@ 2026-11-17 9:23 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-17 9:23 UTC (permalink / raw)
To: Haoli Zhang; +Cc: linux-ext4, tytso
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] ext4: missing Fixes trailer for commit 5701875f9609 in commit
message
--
commit 26f87c9d23ca6ed689130ab579bf0e8089b835d5
Author: Haoli Zhang <26031212468@stu.xidian.edu.cn>
> ext4: validate in-inode xattrs before listing
>
> ext4_iget() validates in-inode xattrs when it reads an inode. However,
> ext4_xattr_ibody_list() fetches the inode-table data again with
> ext4_get_inode_loc() and passes the entries to ext4_xattr_list_entries()
> without validating this read. If the re-read data contains a malformed
> xattr entry, the listing loop can advance beyond the valid in-inode xattr
> area and read invalid memory.
>
> Validate the in-inode xattrs from this read with xattr_check_inode()
> before listing them. If validation fails, skip the listing and return the
> error after releasing the inode-table buffer.
>
> Reported-by: syzbot+3fbf2337de43f5581aec@syzkaller.appspotmail.com
> Closes: https://syzbot.org/bug?extid=3fbf2337de43f5581aec
> Co-developed-by: Jinning Zhang <25031212117@stu.xidian.edu.cn>
> Signed-off-by: Jinning Zhang <25031212117@stu.xidian.edu.cn>
> Co-developed-by: Bin Yu <byu@xidian.edu.cn>
> Signed-off-by: Bin Yu <byu@xidian.edu.cn>
> Signed-off-by: Haoli Zhang <26031212468@stu.xidian.edu.cn>
[Severity: Low]
5701875f9609 ("ext4: fix out-of-bound read in
ext4_xattr_inode_dec_ref_all()") moved xattr_check_inode() into
ext4_iget_extra_inode() and removed it from ext4_xattr_ibody_list().
Should this include:
Fixes: 5701875f9609 ("ext4: fix out-of-bound read in ext4_xattr_inode_dec_ref_all()")
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117090147.3950327-1-26031212468@stu.xidian.edu.cn?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-17 9:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17 9:01 [PATCH] ext4: validate in-inode xattrs before listing Haoli Zhang
2026-11-17 9:23 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox