linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: Fix oops when loading block bitmap failed
@ 2014-10-23 13:05 Jan Kara
  2014-10-29  0:33 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kara @ 2014-10-23 13:05 UTC (permalink / raw)
  To: Ted Tso; +Cc: linux-ext4, 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
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext4/ialloc.c | 4 ++++
 1 file changed, 4 insertions(+)

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) {
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext4: Fix oops when loading block bitmap failed
  2014-10-23 13:05 [PATCH] ext4: Fix oops when loading block bitmap failed Jan Kara
@ 2014-10-29  0:33 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2014-10-29  0:33 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-ext4

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-29  0:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-23 13:05 [PATCH] ext4: Fix oops when loading block bitmap failed Jan Kara
2014-10-29  0:33 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).