kernel_samsung_a53x/fs/ext4
Jan Kara b4693ba24d ext4: fix warning in ext4_dio_write_end_io()
commit 619f75dae2cf117b1d07f27b046b9ffb071c4685 upstream.

The syzbot has reported that it can hit the warning in
ext4_dio_write_end_io() because i_size < i_disksize. Indeed the
reproducer creates a race between DIO IO completion and truncate
expanding the file and thus ext4_dio_write_end_io() sees an inconsistent
inode state where i_disksize is already updated but i_size is not
updated yet. Since we are careful when setting up DIO write and consider
it extending (and thus performing the IO synchronously with i_rwsem held
exclusively) whenever it goes past either of i_size or i_disksize, we
can use the same test during IO completion without risking entering
ext4_handle_inode_extension() without i_rwsem held. This way we make it
obvious both i_size and i_disksize are large enough when we report DIO
completion without relying on unreliable WARN_ON.

Reported-by:  <syzbot+47479b71cdfc78f56d30@syzkaller.appspotmail.com>
Fixes: 91562895f803 ("ext4: properly sync file size update after O_SYNC direct IO")
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Link: https://lore.kernel.org/r/20231130095653.22679-1-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-23 23:21:53 +01:00
..
acl.c
acl.h ext4: apply umask if ACL support is disabled 2024-11-18 11:43:31 +01:00
balloc.c
bitmap.c
block_validity.c
dir.c
ext4.h
ext4_extents.h
ext4_jbd2.c
ext4_jbd2.h
extents.c ext4: fix inode tree inconsistency caused by ENOMEM 2024-11-23 23:21:48 +01:00
extents_status.c ext4: fix infinite loop when replaying fast_commit 2024-11-23 23:20:09 +01:00
extents_status.h ext4: make ext4_es_insert_extent() return void 2024-11-18 23:19:51 +01:00
fast_commit.c
fast_commit.h
file.c ext4: fix warning in ext4_dio_write_end_io() 2024-11-23 23:21:53 +01:00
fsmap.c
fsmap.h
fsync.c
hash.c
ialloc.c ext4: avoid negative min_clusters in find_group_orlov() 2024-11-23 23:21:23 +01:00
indirect.c
inline.c ext4: return error on ext4_find_inline_entry 2024-11-23 23:21:23 +01:00
inode-test.c
inode.c ext4: fix incorrect tid assumption in ext4_wait_for_tail_page_commit() 2024-11-23 23:21:44 +01:00
ioctl.c
Kconfig
Makefile
mballoc.c ext4: clear EXT4_GROUP_INFO_WAS_TRIMMED_BIT even mount with discard 2024-11-23 23:21:23 +01:00
mballoc.h
migrate.c ext4: fix i_data_sem unlock order in ext4_ind_migrate() 2024-11-23 23:21:42 +01:00
mmp.c
move_extent.c ext4: update orig_path in ext4_find_extent() 2024-11-23 23:21:44 +01:00
namei.c ext4: no need to continue when the number of entries is 1 2024-11-23 23:21:43 +01:00
page-io.c ext4: handle redirtying in ext4_bio_write_page() 2024-11-23 23:20:59 +01:00
readpage.c
resize.c ext4: fix corruption during on-line resize 2024-11-19 09:22:34 +01:00
super.c ext4: fix error code saved on super block during file system abort 2024-11-19 14:19:51 +01:00
symlink.c
sysfs.c
truncate.h
verity.c
xattr.c ext4: nested locking for xattr inode 2024-11-23 23:21:49 +01:00
xattr.h
xattr_hurd.c
xattr_security.c
xattr_trusted.c
xattr_user.c