diff options
author | Jason Yan <yanaijie@huawei.com> | 2022-10-25 06:02:06 +0200 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2022-11-06 06:07:59 +0100 |
commit | 9f2a1d9fb33a2129a9ba29bc61d3f14adb28ddc2 (patch) | |
tree | fa4ba763c6f9cd464feaad2381fd93c916b3919e /fs | |
parent | ext4: fix warning in 'ext4_da_release_space' (diff) | |
download | linux-9f2a1d9fb33a2129a9ba29bc61d3f14adb28ddc2.tar.xz linux-9f2a1d9fb33a2129a9ba29bc61d3f14adb28ddc2.zip |
ext4: fix wrong return err in ext4_load_and_init_journal()
The return value is wrong in ext4_load_and_init_journal(). The local
variable 'err' need to be initialized before goto out. The original code
in __ext4_fill_super() is fine because it has two return values 'ret'
and 'err' and 'ret' is initialized as -EINVAL. After we factor out
ext4_load_and_init_journal(), this code is broken. So fix it by directly
returning -EINVAL in the error handler path.
Cc: stable@kernel.org
Fixes: 9c1dd22d7422 ("ext4: factor out ext4_load_and_init_journal()")
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20221025040206.3134773-1-yanaijie@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/super.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index d733db8a0b02..6ddebc9f1b90 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4886,7 +4886,7 @@ out: flush_work(&sbi->s_error_work); jbd2_journal_destroy(sbi->s_journal); sbi->s_journal = NULL; - return err; + return -EINVAL; } static int ext4_journal_data_mode_check(struct super_block *sb) |