diff options
author | Jan Kara <jack@suse.cz> | 2014-10-30 17:53:16 +0300 |
---|---|---|
committer | Zefan Li <lizefan@huawei.com> | 2015-02-02 12:05:08 +0300 |
commit | 8f71a69fa42f842824e488be11c84af325e5feac (patch) | |
tree | 8b4d079192c5b61441315e54f852c40ad8d6f247 | |
parent | 64c7113dc103815f5631f8ed18e10b2b275fa1a0 (diff) | |
download | linux-8f71a69fa42f842824e488be11c84af325e5feac.tar.xz |
ext4: fix oops when loading block bitmap failed
commit 599a9b77ab289d85c2d5c8607624efbe1f552b0f upstream.
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>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Zefan Li <lizefan@huawei.com>
-rw-r--r-- | fs/ext4/ialloc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 75c4f36bced8..97ca4b6fb2a9 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c @@ -725,6 +725,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) { |