Skip to content

Commit 100c273

Browse files
pvts-matPlaidCat
authored andcommitted
ext4: rename s_error_work to s_sb_upd_work
jira VULN-65358 cve-pre CVE-2025-22113 commit-author Theodore Ts'o <tytso@mit.edu> commit bb15cea upstream-diff | Ignored the changes to the `ext4_maybe_update_superblock()' function introduced by ff0722d which is missing from ciqlts9_4 history and is not functionally neutral. The most common use that s_error_work will get scheduled is now the periodic update of the superblock. So rename it to s_sb_upd_work. Also rename the function flush_stashed_error_work() to update_super_work(). Signed-off-by: Theodore Ts'o <tytso@mit.edu> (cherry picked from commit bb15cea) Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
1 parent 45db5af commit 100c273

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

fs/ext4/ext4.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,10 +1732,13 @@ struct ext4_sb_info {
17321732
const char *s_last_error_func;
17331733
time64_t s_last_error_time;
17341734
/*
1735-
* If we are in a context where we cannot update error information in
1736-
* the on-disk superblock, we queue this work to do it.
1735+
* If we are in a context where we cannot update the on-disk
1736+
* superblock, we queue the work here. This is used to update
1737+
* the error information in the superblock, and for periodic
1738+
* updates of the superblock called from the commit callback
1739+
* function.
17371740
*/
1738-
struct work_struct s_error_work;
1741+
struct work_struct s_sb_upd_work;
17391742

17401743
/* Ext4 fast commit sub transaction ID */
17411744
atomic_t s_fc_subtid;

fs/ext4/super.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ static void ext4_handle_error(struct super_block *sb, bool force_ro, int error,
670670
* defer superblock flushing to a workqueue.
671671
*/
672672
if (continue_fs && journal)
673-
schedule_work(&EXT4_SB(sb)->s_error_work);
673+
schedule_work(&EXT4_SB(sb)->s_sb_upd_work);
674674
else
675675
ext4_commit_super(sb);
676676
}
@@ -697,10 +697,10 @@ static void ext4_handle_error(struct super_block *sb, bool force_ro, int error,
697697
sb->s_flags |= SB_RDONLY;
698698
}
699699

700-
static void flush_stashed_error_work(struct work_struct *work)
700+
static void update_super_work(struct work_struct *work)
701701
{
702702
struct ext4_sb_info *sbi = container_of(work, struct ext4_sb_info,
703-
s_error_work);
703+
s_sb_upd_work);
704704
journal_t *journal = sbi->s_journal;
705705
handle_t *handle;
706706

@@ -1010,7 +1010,7 @@ __acquires(bitlock)
10101010
if (!bdev_read_only(sb->s_bdev)) {
10111011
save_error_info(sb, EFSCORRUPTED, ino, block, function,
10121012
line);
1013-
schedule_work(&EXT4_SB(sb)->s_error_work);
1013+
schedule_work(&EXT4_SB(sb)->s_sb_upd_work);
10141014
}
10151015
return;
10161016
}
@@ -1193,10 +1193,10 @@ static void ext4_put_super(struct super_block *sb)
11931193
* Unregister sysfs before destroying jbd2 journal.
11941194
* Since we could still access attr_journal_task attribute via sysfs
11951195
* path which could have sbi->s_journal->j_task as NULL
1196-
* Unregister sysfs before flush sbi->s_error_work.
1196+
* Unregister sysfs before flush sbi->s_sb_upd_work.
11971197
* Since user may read /proc/fs/ext4/xx/mb_groups during umount, If
11981198
* read metadata verify failed then will queue error work.
1199-
* flush_stashed_error_work will call start_this_handle may trigger
1199+
* update_super_work will call start_this_handle may trigger
12001200
* BUG_ON.
12011201
*/
12021202
ext4_unregister_sysfs(sb);
@@ -1208,7 +1208,7 @@ static void ext4_put_super(struct super_block *sb)
12081208
ext4_unregister_li_request(sb);
12091209
ext4_quota_off_umount(sb);
12101210

1211-
flush_work(&sbi->s_error_work);
1211+
flush_work(&sbi->s_sb_upd_work);
12121212
destroy_workqueue(sbi->rsv_conversion_wq);
12131213
ext4_release_orphan_info(sb);
12141214

@@ -4895,8 +4895,8 @@ static int ext4_load_and_init_journal(struct super_block *sb,
48954895
return 0;
48964896

48974897
out:
4898-
/* flush s_error_work before journal destroy. */
4899-
flush_work(&sbi->s_error_work);
4898+
/* flush s_sb_upd_work before destroying the journal. */
4899+
flush_work(&sbi->s_sb_upd_work);
49004900
jbd2_journal_destroy(sbi->s_journal);
49014901
sbi->s_journal = NULL;
49024902
return -EINVAL;
@@ -5246,7 +5246,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
52465246

52475247
timer_setup(&sbi->s_err_report, print_daily_error_info, 0);
52485248
spin_lock_init(&sbi->s_error_lock);
5249-
INIT_WORK(&sbi->s_error_work, flush_stashed_error_work);
5249+
INIT_WORK(&sbi->s_sb_upd_work, update_super_work);
52505250

52515251
err = ext4_group_desc_init(sb, es, logical_sb_block, &first_not_zeroed);
52525252
if (err)
@@ -5635,16 +5635,16 @@ failed_mount8: __maybe_unused
56355635
sbi->s_ea_block_cache = NULL;
56365636

56375637
if (sbi->s_journal) {
5638-
/* flush s_error_work before journal destroy. */
5639-
flush_work(&sbi->s_error_work);
5638+
/* flush s_sb_upd_work before journal destroy. */
5639+
flush_work(&sbi->s_sb_upd_work);
56405640
jbd2_journal_destroy(sbi->s_journal);
56415641
sbi->s_journal = NULL;
56425642
}
56435643
failed_mount3a:
56445644
ext4_es_unregister_shrinker(sbi);
56455645
failed_mount3:
5646-
/* flush s_error_work before sbi destroy */
5647-
flush_work(&sbi->s_error_work);
5646+
/* flush s_sb_upd_work before sbi destroy */
5647+
flush_work(&sbi->s_sb_upd_work);
56485648
del_timer_sync(&sbi->s_err_report);
56495649
ext4_stop_mmpd(sbi);
56505650
ext4_group_desc_free(sbi);
@@ -6507,7 +6507,7 @@ static int __ext4_remount(struct fs_context *fc, struct super_block *sb)
65076507
}
65086508

65096509
/* Flush outstanding errors before changing fs state */
6510-
flush_work(&sbi->s_error_work);
6510+
flush_work(&sbi->s_sb_upd_work);
65116511

65126512
if ((bool)(fc->sb_flags & SB_RDONLY) != sb_rdonly(sb)) {
65136513
if (ext4_test_mount_flag(sb, EXT4_MF_FS_ABORTED)) {

0 commit comments

Comments
 (0)