Skip to content

Commit 44d2a72

Browse files
deepanshu406tytso
authored andcommitted
ext4: validate ea_ino and size in check_xattrs
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: [email protected] Suggested-by: Theodore Ts'o <[email protected]> Reported-by: [email protected] Link: https://syzkaller.appspot.com/bug?extid=4c9d23743a2409b80293 Signed-off-by: Deepanshu Kartikey <[email protected]> Signed-off-by: Theodore Ts'o <[email protected]> Message-ID: <[email protected]> Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 57295e8 commit 44d2a72

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/ext4/xattr.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,10 @@ check_xattrs(struct inode *inode, struct buffer_head *bh,
251251
err_str = "invalid ea_ino";
252252
goto errout;
253253
}
254+
if (ea_ino && !size) {
255+
err_str = "invalid size in ea xattr";
256+
goto errout;
257+
}
254258
if (size > EXT4_XATTR_SIZE_MAX) {
255259
err_str = "e_value size too large";
256260
goto errout;

0 commit comments

Comments
 (0)