Skip to content

Commit

Permalink
ext4: return error code when ext4_fill_flex_info() fails
Browse files Browse the repository at this point in the history
commit 8f6840c upstream.

After commit c89128a ("ext4: handle errors on
ext4_commit_super"), 'ret' may be set to 0 before calling
ext4_fill_flex_info(), if ext4_fill_flex_info() fails ext4_mount()
doesn't return error code, it makes 'root' is null which causes crash
in legacy_get_tree().

Fixes: c89128a ("ext4: handle errors on ext4_commit_super")
Reported-by: Hulk Robot <hulkci@huawei.com>
Cc: <stable@vger.kernel.org> # v4.18+
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210510111051.55650-1-yangyingliang@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Yang Yingliang authored and gregkh committed Jul 14, 2021
1 parent b368b03 commit f4e91a4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/ext4/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -5046,6 +5046,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
ext4_msg(sb, KERN_ERR,
"unable to initialize "
"flex_bg meta info!");
ret = -ENOMEM;
goto failed_mount6;
}

Expand Down

0 comments on commit f4e91a4

Please sign in to comment.