Skip to content

Commit

Permalink
ext4: fix wrong return err in ext4_load_and_init_journal()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
JasonYanHw authored and tytso committed Nov 6, 2022
1 parent 1b8f787 commit 9f2a1d9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/ext4/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -4886,7 +4886,7 @@ static int ext4_load_and_init_journal(struct super_block *sb,
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)
Expand Down

0 comments on commit 9f2a1d9

Please sign in to comment.