[PATCH 4.19 021/421] ext4: return error code when ext4_fill_flex_info() fails

From
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date
2021-07-19 15:47:02
Also in
lkml
Reply to
Greg Kroah-Hartman, 2021-07-19
From: Yang Yingliang <redacted>

commit 8f6840c4fd1e7bd715e403074fb161c1a04cda73 upstream.

After commit c89128a00838 ("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: c89128a00838 ("ext4: handle errors on ext4_commit_super")
Reported-by: Hulk Robot <redacted>
Cc: <redacted> # v4.18+
Signed-off-by: Yang Yingliang <redacted>
Link: https://lore.kernel.org/r/20210510111051.55650-1-yangyingliang@huawei.com (local)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ext4/super.c |    1 +
 1 file changed, 1 insertion(+)
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4524,6 +4524,7 @@ no_journal:
 			ext4_msg(sb, KERN_ERR,
 			       "unable to initialize "
 			       "flex_bg meta info!");
+			ret = -ENOMEM;
 			goto failed_mount6;
 		}
 

Thread (423 messages) 423 messages, 2 authors, last reply 2021-07-19
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help