Skip to content

Commit 83606ff

Browse files
committed
ext4: rename s_error_work to s_sb_upd_work
jira VULN-65357 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_2 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: Brett Mastbergen <bmastbergen@ciq.com>
1 parent 62f6a66 commit 83606ff

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
@@ -1727,10 +1727,13 @@ struct ext4_sb_info {
17271727
const char *s_last_error_func;
17281728
time64_t s_last_error_time;
17291729
/*
1730-
* If we are in a context where we cannot update error information in
1731-
* the on-disk superblock, we queue this work to do it.
1730+
* If we are in a context where we cannot update the on-disk
1731+
* superblock, we queue the work here. This is used to update
1732+
* the error information in the superblock, and for periodic
1733+
* updates of the superblock called from the commit callback
1734+
* function.
17321735
*/
1733-
struct work_struct s_error_work;
1736+
struct work_struct s_sb_upd_work;
17341737

17351738
/* Ext4 fast commit sub transaction ID */
17361739
atomic_t s_fc_subtid;

fs/ext4/super.c

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

701-
static void flush_stashed_error_work(struct work_struct *work)
701+
static void update_super_work(struct work_struct *work)
702702
{
703703
struct ext4_sb_info *sbi = container_of(work, struct ext4_sb_info,
704-
s_error_work);
704+
s_sb_upd_work);
705705
journal_t *journal = sbi->s_journal;
706706
handle_t *handle;
707707

@@ -1011,7 +1011,7 @@ __acquires(bitlock)
10111011
if (!bdev_read_only(sb->s_bdev)) {
10121012
save_error_info(sb, EFSCORRUPTED, ino, block, function,
10131013
line);
1014-
schedule_work(&EXT4_SB(sb)->s_error_work);
1014+
schedule_work(&EXT4_SB(sb)->s_sb_upd_work);
10151015
}
10161016
return;
10171017
}
@@ -1189,10 +1189,10 @@ static void ext4_put_super(struct super_block *sb)
11891189
* Unregister sysfs before destroying jbd2 journal.
11901190
* Since we could still access attr_journal_task attribute via sysfs
11911191
* path which could have sbi->s_journal->j_task as NULL
1192-
* Unregister sysfs before flush sbi->s_error_work.
1192+
* Unregister sysfs before flush sbi->s_sb_upd_work.
11931193
* Since user may read /proc/fs/ext4/xx/mb_groups during umount, If
11941194
* read metadata verify failed then will queue error work.
1195-
* flush_stashed_error_work will call start_this_handle may trigger
1195+
* update_super_work will call start_this_handle may trigger
11961196
* BUG_ON.
11971197
*/
11981198
ext4_unregister_sysfs(sb);
@@ -1203,7 +1203,7 @@ static void ext4_put_super(struct super_block *sb)
12031203
ext4_unregister_li_request(sb);
12041204
ext4_quota_off_umount(sb);
12051205

1206-
flush_work(&sbi->s_error_work);
1206+
flush_work(&sbi->s_sb_upd_work);
12071207
destroy_workqueue(sbi->rsv_conversion_wq);
12081208
ext4_release_orphan_info(sb);
12091209

@@ -4892,8 +4892,8 @@ static int ext4_load_and_init_journal(struct super_block *sb,
48924892
return 0;
48934893

48944894
out:
4895-
/* flush s_error_work before journal destroy. */
4896-
flush_work(&sbi->s_error_work);
4895+
/* flush s_sb_upd_work before destroying the journal. */
4896+
flush_work(&sbi->s_sb_upd_work);
48974897
jbd2_journal_destroy(sbi->s_journal);
48984898
sbi->s_journal = NULL;
48994899
return -EINVAL;
@@ -5241,7 +5241,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
52415241

52425242
timer_setup(&sbi->s_err_report, print_daily_error_info, 0);
52435243
spin_lock_init(&sbi->s_error_lock);
5244-
INIT_WORK(&sbi->s_error_work, flush_stashed_error_work);
5244+
INIT_WORK(&sbi->s_sb_upd_work, update_super_work);
52455245

52465246
/* Register extent status tree shrinker */
52475247
if (ext4_es_register_shrinker(sbi))
@@ -5601,16 +5601,16 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
56015601
sbi->s_ea_block_cache = NULL;
56025602

56035603
if (sbi->s_journal) {
5604-
/* flush s_error_work before journal destroy. */
5605-
flush_work(&sbi->s_error_work);
5604+
/* flush s_sb_upd_work before journal destroy. */
5605+
flush_work(&sbi->s_sb_upd_work);
56065606
jbd2_journal_destroy(sbi->s_journal);
56075607
sbi->s_journal = NULL;
56085608
}
56095609
failed_mount3a:
56105610
ext4_es_unregister_shrinker(sbi);
56115611
failed_mount3:
5612-
/* flush s_error_work before sbi destroy */
5613-
flush_work(&sbi->s_error_work);
5612+
/* flush s_sb_upd_work before sbi destroy */
5613+
flush_work(&sbi->s_sb_upd_work);
56145614
del_timer_sync(&sbi->s_err_report);
56155615
ext4_stop_mmpd(sbi);
56165616
ext4_group_desc_free(sbi);
@@ -6426,7 +6426,7 @@ static int __ext4_remount(struct fs_context *fc, struct super_block *sb)
64266426
}
64276427

64286428
/* Flush outstanding errors before changing fs state */
6429-
flush_work(&sbi->s_error_work);
6429+
flush_work(&sbi->s_sb_upd_work);
64306430

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

0 commit comments

Comments
 (0)