aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs
diff options
context:
space:
mode:
authorDmitriy Monakhov <dmonakhov@sw.ru>2007-05-08 03:24:37 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:14:59 -0400
commit2d3466a348a61c4d7f958ce80020eba17c09d7f7 (patch)
treeeda69787ec28632b162638055b60dc8371f6432b /fs/reiserfs
parent82f703bb8cb2732b4437a9f555a1be564e9e71c2 (diff)
reiserfs: possible null pointer dereference during resize
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> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/reiserfs')
-rw-r--r--fs/reiserfs/resize.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/reiserfs/resize.c b/fs/reiserfs/resize.c
index 315684793d1d..976cc7887a0d 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)
131 /* don't use read_bitmap_block since it will cache 131 /* don't use read_bitmap_block since it will cache
132 * the uninitialized bitmap */ 132 * the uninitialized bitmap */
133 bh = sb_bread(s, i * s->s_blocksize * 8); 133 bh = sb_bread(s, i * s->s_blocksize * 8);
134 if (!bh) {
135 vfree(bitmap);
136 return -EIO;
137 }
134 memset(bh->b_data, 0, sb_blocksize(sb)); 138 memset(bh->b_data, 0, sb_blocksize(sb));
135 reiserfs_test_and_set_le_bit(0, bh->b_data); 139 reiserfs_test_and_set_le_bit(0, bh->b_data);
136 reiserfs_cache_bitmap_metadata(s, bh, bitmap + i); 140 reiserfs_cache_bitmap_metadata(s, bh, bitmap + i);