Skip to contentSkip to conversation

ext4: Fix oops when loading block bitmap failed

PATCH Applied Jan Kara 2 participants 2 messages Oct 23, 2014 – Oct 29, 2014 ext4 file system

lore
Share & tools
lore

Jan Kara

author reviewer
#0 lore raw

PATCH 1/1 ext4: Fix oops when loading block bitmap failed

When we fail to load block bitmap in __ext4_new_inode() we will dereference NULL pointer in ext4_journal_get_write_access(). So check for error from ext4_read_block_bitmap().

Coverity-id: 989065

---
 fs/ext4/ialloc.c | 4 ++++
 1 file changed, 4 insertions(+)
fs/ext4/ialloc.c +4 -0
index 8012a5daf401..ac644c31ca67 100644
@@ -887,6 +887,10 @@ got:
 		struct buffer_head *block_bitmap_bh;
 
 		block_bitmap_bh = ext4_read_block_bitmap(sb, group);
+		if (!block_bitmap_bh) {
+			err = -EIO;
+			goto out;
+		}
 		BUFFER_TRACE(block_bitmap_bh, "get block bitmap access");
 		err = ext4_journal_get_write_access(handle, block_bitmap_bh);
 		if (err) {
Signature · 1 line
1.8.1.4
maintainer Applied
#1 lore raw
Quoted 6 lines · Jan Kara

When we fail to load block bitmap in __ext4_new_inode() we will dereference NULL pointer in ext4_journal_get_write_access(). So check for error from ext4_read_block_bitmap().

Coverity-id: 989065

Thanks, applied.

- Ted