diff options
| author | Deepanshu Kartikey <kartikey406@gmail.com> | 2025-09-23 19:02:45 +0530 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-10-19 16:30:56 +0200 |
| commit | 720a66fdaa6ce3d68e5ad4a469fd428a8d7ce571 (patch) | |
| tree | 5d8771777ff15f193d63dbb3cb3f2852ebfedf3d | |
| parent | 79ea7f3e11effe1bd9e753172981d9029133a278 (diff) | |
| download | linux-720a66fdaa6ce3d68e5ad4a469fd428a8d7ce571.tar.gz linux-720a66fdaa6ce3d68e5ad4a469fd428a8d7ce571.tar.bz2 linux-720a66fdaa6ce3d68e5ad4a469fd428a8d7ce571.zip | |
ext4: validate ea_ino and size in check_xattrs
commit 44d2a72f4d64655f906ba47a5e108733f59e6f28 upstream.
During xattr block validation, check_xattrs() processes xattr entries
without validating that entries claiming to use EA inodes have non-zero
sizes. Corrupted filesystems may contain xattr entries where e_value_size
is zero but e_value_inum is non-zero, indicating invalid xattr data.
Add validation in check_xattrs() to detect this corruption pattern early
and return -EFSCORRUPTED, preventing invalid xattr entries from causing
issues throughout the ext4 codebase.
Cc: stable@kernel.org
Suggested-by: Theodore Ts'o <tytso@mit.edu>
Reported-by: syzbot+4c9d23743a2409b80293@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=4c9d23743a2409b80293
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Message-ID: <20250923133245.1091761-1-kartikey406@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | fs/ext4/xattr.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 11ccff9fae4b..66933e55efb3 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -251,6 +251,10 @@ check_xattrs(struct inode *inode, struct buffer_head *bh, err_str = "invalid ea_ino"; goto errout; } + if (ea_ino && !size) { + err_str = "invalid size in ea xattr"; + goto errout; + } if (size > EXT4_XATTR_SIZE_MAX) { err_str = "e_value size too large"; goto errout; |
