ext4: fix wrong return err in ext4_load_and_init_journal()
authorJason Yan <yanaijie@huawei.com>
Tue, 25 Oct 2022 04:02:06 +0000 (12:02 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 6 Nov 2022 05:07:59 +0000 (01:07 -0400)
commit9f2a1d9fb33a2129a9ba29bc61d3f14adb28ddc2
treefa4ba763c6f9cd464feaad2381fd93c916b3919e
parent1b8f787ef547230a3249bcf897221ef0cc78481b
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>
fs/ext4/super.c