Skip to content

Commit 9f2a1d9

Browse files
JasonYanHwtytso
authored andcommitted
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: [email protected] Fixes: 9c1dd22 ("ext4: factor out ext4_load_and_init_journal()") Signed-off-by: Jason Yan <[email protected]> Reviewed-by: Jan Kara <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 1b8f787 commit 9f2a1d9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/ext4/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4886,7 +4886,7 @@ static int ext4_load_and_init_journal(struct super_block *sb,
48864886
flush_work(&sbi->s_error_work);
48874887
jbd2_journal_destroy(sbi->s_journal);
48884888
sbi->s_journal = NULL;
4889-
return err;
4889+
return -EINVAL;
48904890
}
48914891

48924892
static int ext4_journal_data_mode_check(struct super_block *sb)

0 commit comments

Comments
 (0)