aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Czerner <[email protected]>2022-01-19 14:02:09 +0100
committerTheodore Ts'o <[email protected]>2022-02-03 10:57:44 -0500
commit7c268d4ce2d3761f666a9950b029c8902bfab710 (patch)
treefb0739349fdd94bc701740fa59cf79a79727410b
parent4f98186848707f530669238d90e0562d92a78aab (diff)
ext4: fix potential NULL pointer dereference in ext4_fill_super()
By mistake we fail to return an error from ext4_fill_super() in case that ext4_alloc_sbi() fails to allocate a new sbi. Instead we just set the ret variable and allow the function to continue which will later lead to a NULL pointer dereference. Fix it by returning -ENOMEM in the case ext4_alloc_sbi() fails. Fixes: cebe85d570cf ("ext4: switch to the new mount api") Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Lukas Czerner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]> Cc: [email protected]
-rw-r--r--fs/ext4/super.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 57914acc5402..d1c4b04e72ab 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5541,7 +5541,7 @@ static int ext4_fill_super(struct super_block *sb, struct fs_context *fc)
sbi = ext4_alloc_sbi(sb);
if (!sbi)
- ret = -ENOMEM;
+ return -ENOMEM;
fc->s_fs_info = sbi;