Skip to contentSkip to conversation

ext4: handle unsuccessful sbi allocation

PATCH In review Ameer Hamza 2 participants 2 messages Jan 25, 2022 ext4 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext4: handle unsuccessful sbi allocation

Move to common fail path in case of unsuccessful sbi allocation

Addresses-Coverity: 1497833 ("Unused value")

---
 fs/ext4/super.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ext4/super.c +3 -1
index 57914acc5402..0dccf1ed931b 100644
@@ -5540,8 +5540,10 @@ static int ext4_fill_super(struct super_block *sb, struct fs_context *fc)
 	int ret;
 
 	sbi = ext4_alloc_sbi(sb);
-	if (!sbi)
+	if (!sbi) {
 		ret = -ENOMEM;
+		goto free_sbi;
+	}
 
 	fc->s_fs_info = sbi;
 
Signature · 1 line
2.25.1
#1 lore raw

We already have a patch to fix the problem on this list

https://lore.kernel.org/linux-ext4/[email protected]/T/#u

-Lukas

Quoted 28 lines · Ameer Hamza

Move to common fail path in case of unsuccessful sbi allocation

Addresses-Coverity: 1497833 ("Unused value")

---
 fs/ext4/super.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ext4/super.c +3 -1
index 57914acc5402..0dccf1ed931b 100644
@@ -5540,8 +5540,10 @@ static int ext4_fill_super(struct super_block *sb, struct fs_context *fc)
 	int ret;
 
 	sbi = ext4_alloc_sbi(sb);
-	if (!sbi)
+	if (!sbi) {
 		ret = -ENOMEM;
+		goto free_sbi;
+	}
 
 	fc->s_fs_info = sbi;
 
Signature · 1 line
2.25.1