diff mbox

ext4: Fix oops when loading block bitmap failed

Message ID 1414069527-29803-1-git-send-email-jack@suse.cz
State Accepted, archived
Headers show

Commit Message

Jan Kara Oct. 23, 2014, 1:05 p.m. UTC
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
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext4/ialloc.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Theodore Ts'o Oct. 29, 2014, 12:33 a.m. UTC | #1
On Thu, Oct 23, 2014 at 03:05:27PM +0200, Jan Kara wrote:
> 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
> Signed-off-by: Jan Kara <jack@suse.cz>

Thanks, applied.

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 8012a5daf401..ac644c31ca67 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -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) {