Skip to content

Commit

Permalink
ext4: fix oops when loading block bitmap failed
Browse files Browse the repository at this point in the history
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
Cc: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
  • Loading branch information
Jan Kara authored and Theodore Ts'o committed Oct 30, 2014
1 parent 9378c67 commit 599a9b7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/ext4/ialloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,10 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,
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) {
Expand Down

0 comments on commit 599a9b7

Please sign in to comment.