ext4: fix potential NULL pointer dereference in ext4_fill_super()
PATCH 1/1 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.
--- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/super.c +1 -1
@@ -5543,7 +5543,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;
Signature · 1 line
2.31.1
Quoted 8 lines · Lukas Czerner
By mistake we fail to return an error from
ext4_fill_super()in case thatext4_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-ENOMEMin the caseext4_alloc_sbi()fails.[...]
Applied, thanks!
[1/1] ext4: fix potential NULL pointer dereference in ext4_fill_super()
commit: 7c6bb3d664aa05bf4366fd79a13921acfca28a6d
Best regards,
Signature · 1 line
Theodore Ts'o <[email protected]>