All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] reiserfs: possible null pointer dereference during resize
@ 2007-02-20  7:58 Dmitriy Monakhov
  0 siblings, 0 replies; only message in thread
From: Dmitriy Monakhov @ 2007-02-20  7:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: reiserfs-list

[-- Attachment #1: Type: text/plain, Size: 230 bytes --]

sb_read may return NULL, let's explicitly check it.
If so free new bitmap blocks array, after this we may safely exit as it done
above during bitmap allocation.
Signed-off-by: Dmitriy Monakhov <dmonakhov@openvz.org>
-------------

[-- Attachment #2: diff-mm-reiserfs-resize-sb_read-errh-fix --]
[-- Type: text/plain, Size: 580 bytes --]

diff --git a/fs/reiserfs/resize.c b/fs/reiserfs/resize.c
index 3156847..976cc78 100644
--- a/fs/reiserfs/resize.c
+++ b/fs/reiserfs/resize.c
@@ -131,6 +131,10 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
 			/* don't use read_bitmap_block since it will cache
 			 * the uninitialized bitmap */
 			bh = sb_bread(s, i * s->s_blocksize * 8);
+			if (!bh) {
+				vfree(bitmap);
+				return -EIO;
+			}
 			memset(bh->b_data, 0, sb_blocksize(sb));
 			reiserfs_test_and_set_le_bit(0, bh->b_data);
 			reiserfs_cache_bitmap_metadata(s, bh, bitmap + i);

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-02-20  7:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-20  7:58 [patch] reiserfs: possible null pointer dereference during resize Dmitriy Monakhov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.