Skip to content

Commit 599a9b7

Browse files
jankaratytso
authored andcommitted
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 Cc: stable@vger.kernel.org Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 parent 9378c67 commit 599a9b7

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎fs/ext4/ialloc.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,10 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,
887887
struct buffer_head *block_bitmap_bh;
888888

889889
block_bitmap_bh = ext4_read_block_bitmap(sb, group);
890+
if (!block_bitmap_bh) {
891+
err = -EIO;
892+
goto out;
893+
}
890894
BUFFER_TRACE(block_bitmap_bh, "get block bitmap access");
891895
err = ext4_journal_get_write_access(handle, block_bitmap_bh);
892896
if (err) {

0 commit comments

Comments
 (0)