aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2010-03-25 08:37:12 -0400
committerChris Mason <chris.mason@oracle.com>2010-03-30 21:19:08 -0400
commit90d2c51dbb4db05c040bc7db264bb7ab35e35455 (patch)
treed97b50f0a064366aecce9671b8e1791263999e59 /fs
parent2f3014fc2ab1e25c36531e19164c48182c168995 (diff)
Btrfs: add NULL check for do_walk_down()
btrfs_find_create_tree_block() may return NULL, so we must check the returned value, or we will access a NULL pointer. Signed-off-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/extent-tree.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 1727b26fb194..503a18eaef52 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -5205,6 +5205,8 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans,
5205 next = btrfs_find_tree_block(root, bytenr, blocksize); 5205 next = btrfs_find_tree_block(root, bytenr, blocksize);
5206 if (!next) { 5206 if (!next) {
5207 next = btrfs_find_create_tree_block(root, bytenr, blocksize); 5207 next = btrfs_find_create_tree_block(root, bytenr, blocksize);
5208 if (!next)
5209 return -ENOMEM;
5208 reada = 1; 5210 reada = 1;
5209 } 5211 }
5210 btrfs_tree_lock(next); 5212 btrfs_tree_lock(next);
@@ -5417,7 +5419,8 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans,
5417 if (ret > 0) { 5419 if (ret > 0) {
5418 path->slots[level]++; 5420 path->slots[level]++;
5419 continue; 5421 continue;
5420 } 5422 } else if (ret < 0)
5423 return ret;
5421 level = wc->level; 5424 level = wc->level;
5422 } 5425 }
5423 return 0; 5426 return 0;