summaryrefslogtreecommitdiff
path: root/rust/helpers/err.c
diff options
context:
space:
mode:
authorBaokun Li <libaokun1@huawei.com>2025-07-08 19:15:04 +0800
committerTheodore Ts'o <tytso@mit.edu>2025-07-17 23:25:21 -0400
commitc678bdc998754589cea2e6afab9401d7d8312ac4 (patch)
tree1b70e6a222872e20464764f5310b291a3f6c5d9e /rust/helpers/err.c
parent9d9076238fe9fe45257f298bf51b35aa796cf0f1 (diff)
ext4: fix inode use after free in ext4_end_io_rsv_work()
In ext4_io_end_defer_completion(), check if io_end->list_vec is empty to avoid adding an io_end that requires no conversion to the i_rsv_conversion_list, which in turn prevents starting an unnecessary worker. An ext4_emergency_state() check is also added to avoid attempting to abort the journal in an emergency state. Additionally, ext4_put_io_end_defer() is refactored to call ext4_io_end_defer_completion() directly instead of being open-coded. This also prevents starting an unnecessary worker when EXT4_IO_END_FAILED is set but data_err=abort is not enabled. This ensures that the check in ext4_put_io_end_defer() is consistent with the check in ext4_end_bio(). Otherwise, we might add an io_end to the i_rsv_conversion_list and then call ext4_finish_bio(), after which the inode could be freed before ext4_end_io_rsv_work() is called, triggering a use-after-free issue. Fixes: ce51afb8cc5e ("ext4: abort journal on data writeback failure if in data_err=abort mode") Signed-off-by: Baokun Li <libaokun1@huawei.com> Reviewed-by: Zhang Yi <yi.zhang@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Link: https://patch.msgid.link/20250708111504.3208660-1-libaokun@huaweicloud.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'rust/helpers/err.c')
0 files changed, 0 insertions, 0 deletions