aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTsutomu Itoh <t-itoh@jp.fujitsu.com>2012-02-16 02:23:58 -0500
committerDavid Sterba <dsterba@suse.cz>2012-02-16 11:23:17 -0500
commit285190d99fef696ec8b0041787387f013cb71d67 (patch)
treed55c5e3f71718cb21f9349280fb160d0403d082d /fs
parent600a45e1d5e376f679ff9ecc4ce9452710a6d27c (diff)
Btrfs: check return value of lookup_extent_mapping() correctly
This patch corrects error checking of lookup_extent_mapping(). Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/compression.c2
-rw-r--r--fs/btrfs/extent_io.c2
-rw-r--r--fs/btrfs/volumes.c2
3 files changed, 4 insertions, 2 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 14f1c5a0b2d2..d02c27cd14c7 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -588,6 +588,8 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
588 page_offset(bio->bi_io_vec->bv_page), 588 page_offset(bio->bi_io_vec->bv_page),
589 PAGE_CACHE_SIZE); 589 PAGE_CACHE_SIZE);
590 read_unlock(&em_tree->lock); 590 read_unlock(&em_tree->lock);
591 if (!em)
592 return -EIO;
591 593
592 compressed_len = em->block_len; 594 compressed_len = em->block_len;
593 cb = kmalloc(compressed_bio_size(root, compressed_len), GFP_NOFS); 595 cb = kmalloc(compressed_bio_size(root, compressed_len), GFP_NOFS);
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index b05d35a7c0f1..8d6f55fbd28e 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -3308,7 +3308,7 @@ int try_release_extent_mapping(struct extent_map_tree *map,
3308 len = end - start + 1; 3308 len = end - start + 1;
3309 write_lock(&map->lock); 3309 write_lock(&map->lock);
3310 em = lookup_extent_mapping(map, start, len); 3310 em = lookup_extent_mapping(map, start, len);
3311 if (IS_ERR_OR_NULL(em)) { 3311 if (!em) {
3312 write_unlock(&map->lock); 3312 write_unlock(&map->lock);
3313 break; 3313 break;
3314 } 3314 }
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index d8f282b5baa9..cd040bf3fd87 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1954,7 +1954,7 @@ static int btrfs_relocate_chunk(struct btrfs_root *root,
1954 em = lookup_extent_mapping(em_tree, chunk_offset, 1); 1954 em = lookup_extent_mapping(em_tree, chunk_offset, 1);
1955 read_unlock(&em_tree->lock); 1955 read_unlock(&em_tree->lock);
1956 1956
1957 BUG_ON(em->start > chunk_offset || 1957 BUG_ON(!em || em->start > chunk_offset ||
1958 em->start + em->len < chunk_offset); 1958 em->start + em->len < chunk_offset);
1959 map = (struct map_lookup *)em->bdev; 1959 map = (struct map_lookup *)em->bdev;
1960 1960