summaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2010-03-25 13:37:12 +0100
committerChris Mason <chris.mason@oracle.com>2010-03-31 03:19:08 +0200
commit90d2c51dbb4db05c040bc7db264bb7ab35e35455 (patch)
treed97b50f0a064366aecce9671b8e1791263999e59 /fs/btrfs
parentBtrfs: remove duplicate include in ioctl.c (diff)
downloadlinux-90d2c51dbb4db05c040bc7db264bb7ab35e35455.tar.xz
linux-90d2c51dbb4db05c040bc7db264bb7ab35e35455.zip
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/btrfs')
-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,
next = btrfs_find_tree_block(root, bytenr, blocksize);
if (!next) {
next = btrfs_find_create_tree_block(root, bytenr, blocksize);
+ if (!next)
+ return -ENOMEM;
reada = 1;
}
btrfs_tree_lock(next);
@@ -5417,7 +5419,8 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans,
if (ret > 0) {
path->slots[level]++;
continue;
- }
+ } else if (ret < 0)
+ return ret;
level = wc->level;
}
return 0;