diff options
author | Tsutomu Itoh <t-itoh@jp.fujitsu.com> | 2011-03-24 02:33:21 -0400 |
---|---|---|
committer | root <Chris Mason chris.mason@oracle.com> | 2011-03-28 05:37:37 -0400 |
commit | 97d9a8a420444eb5b5c071d4b3b9c4100a7ae015 (patch) | |
tree | 4ed3e77541ebcc4885c4a10630e2f6bf94d3cef2 /fs/btrfs/extent-tree.c | |
parent | 7e75bf3ff3a716d7b21d8fb43bf823115801c1e9 (diff) |
Btrfs: check return value of read_tree_block()
This patch is checking return value of read_tree_block(),
and if it is NULL, error processing.
Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index a6a8159c5d1e..5bc658a9d85c 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -6067,6 +6067,8 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans, | |||
6067 | if (reada && level == 1) | 6067 | if (reada && level == 1) |
6068 | reada_walk_down(trans, root, wc, path); | 6068 | reada_walk_down(trans, root, wc, path); |
6069 | next = read_tree_block(root, bytenr, blocksize, generation); | 6069 | next = read_tree_block(root, bytenr, blocksize, generation); |
6070 | if (!next) | ||
6071 | return -EIO; | ||
6070 | btrfs_tree_lock(next); | 6072 | btrfs_tree_lock(next); |
6071 | btrfs_set_lock_blocking(next); | 6073 | btrfs_set_lock_blocking(next); |
6072 | } | 6074 | } |
@@ -7937,6 +7939,10 @@ static noinline int relocate_one_extent(struct btrfs_root *extent_root, | |||
7937 | 7939 | ||
7938 | eb = read_tree_block(found_root, block_start, | 7940 | eb = read_tree_block(found_root, block_start, |
7939 | block_size, 0); | 7941 | block_size, 0); |
7942 | if (!eb) { | ||
7943 | ret = -EIO; | ||
7944 | goto out; | ||
7945 | } | ||
7940 | btrfs_tree_lock(eb); | 7946 | btrfs_tree_lock(eb); |
7941 | BUG_ON(level != btrfs_header_level(eb)); | 7947 | BUG_ON(level != btrfs_header_level(eb)); |
7942 | 7948 | ||