android_kernel_motorola_sm6375/fs/ext4
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Deepanshu Kartikey 4954d297c9 ext4: detect invalid INLINE_DATA + EXTENTS flag combination
[ Upstream commit 1d3ad183943b38eec2acf72a0ae98e635dc8456b ]

syzbot reported a BUG_ON in ext4_es_cache_extent() when opening a verity
file on a corrupted ext4 filesystem mounted without a journal.

The issue is that the filesystem has an inode with both the INLINE_DATA
and EXTENTS flags set:

    EXT4-fs error (device loop0): ext4_cache_extents:545: inode #15:
    comm syz.0.17: corrupted extent tree: lblk 0 < prev 66

Investigation revealed that the inode has both flags set:
    DEBUG: inode 15 - flag=1, i_inline_off=164, has_inline=1, extents_flag=1

This is an invalid combination since an inode should have either:
- INLINE_DATA: data stored directly in the inode
- EXTENTS: data stored in extent-mapped blocks

Having both flags causes ext4_has_inline_data() to return true, skipping
extent tree validation in __ext4_iget(). The unvalidated out-of-order
extents then trigger a BUG_ON in ext4_es_cache_extent() due to integer
underflow when calculating hole sizes.

Fix this by detecting this invalid flag combination early in ext4_iget()
and rejecting the corrupted inode.

Cc: [email protected]
Reported-and-tested-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?extid=038b7bf43423e132b308
Suggested-by: Zhang Yi <[email protected]>
Signed-off-by: Deepanshu Kartikey <[email protected]>
Reviewed-by: Zhang Yi <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Theodore Ts'o <[email protected]>
[ Adjust context ]
Signed-off-by: Sasha Levin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2025-10-29 14:00:01 +01:00
..
acl.c
acl.h ext4: apply umask if ACL support is disabled 2023-11-28 16:50:21 +00:00
balloc.c ext4: reorder capability check last 2025-06-04 14:32:31 +02:00
bitmap.c
block_validity.c
dir.c ext4: fix OOB read when checking dotdot dir 2025-05-02 07:39:24 +02:00
ext4.h ext4: avoid ext4_error()'s caused by ENOMEM in the truncate path 2025-02-01 18:18:53 +01:00
ext4_extents.h
ext4_jbd2.c
ext4_jbd2.h
extents.c ext4: fix calculation of credits for extent tree modification 2025-06-27 11:02:51 +01:00
extents_status.c ext4: make sure allocate pending entry not fail 2023-12-08 08:44:24 +01:00
extents_status.h
file.c
fsmap.c ext4: correctly handle queries for metadata mappings 2025-10-29 13:59:54 +01:00
fsmap.h
fsync.c
hash.c
ialloc.c ext4: avoid negative min_clusters in find_group_orlov() 2024-11-08 16:20:30 +01:00
indirect.c ext4: only update i_reserved_data_blocks on successful block allocation 2023-07-27 08:37:35 +02:00
inline.c ext4: do not BUG when INLINE_DATA_FL lacks system.data xattr 2025-08-28 16:21:27 +02:00
inode.c ext4: detect invalid INLINE_DATA + EXTENTS flag combination 2025-10-29 14:00:01 +01:00
ioctl.c ext4: fix to check return value of freeze_bdev() in ext4_shutdown() 2023-08-11 11:53:47 +02:00
Kconfig
Makefile
mballoc.c ext4: fix FS_IOC_GETFSMAP handling 2024-12-14 19:44:35 +01:00
mballoc.h ext4: fix FS_IOC_GETFSMAP handling 2024-12-14 19:44:35 +01:00
migrate.c ext4: fix i_data_sem unlock order in ext4_ind_migrate() 2024-11-08 16:20:39 +01:00
mmp.c
move_extent.c ext4: fix double-free of blocks due to wrong extents moved_len 2024-02-23 08:25:11 +01:00
namei.c ext4: fix off-by-one error in do_split 2025-05-02 07:39:15 +02:00
page-io.c ext4: fix cgroup writeback accounting with fs-layer encryption 2023-03-22 13:28:03 +01:00
readpage.c
resize.c ext4: fix corruption during on-line resize 2024-04-13 12:51:26 +02:00
super.c ext4: avoid potential buffer over-read in parse_apply_sb_mount_options() 2025-10-29 14:00:01 +01:00
symlink.c
sysfs.c ext4: Fix function prototype mismatch for ext4_feat_ktype 2023-02-25 11:53:27 +01:00
truncate.h
verity.c fs: ext4: initialize fsdata in pagecache_write() 2023-01-18 11:41:55 +01:00
xattr.c ext4: guard against EA inode refcount underflow in xattr update 2025-10-29 13:59:54 +01:00
xattr.h ext4: remove duplicate definition of ext4_xattr_ibody_inline_set() 2023-04-26 11:24:05 +02:00
xattr_security.c
xattr_trusted.c
xattr_user.c