diff options
author | Yan, Zheng <zheng.yan@oracle.com> | 2010-05-31 08:58:47 +0000 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2010-06-11 15:48:34 -0400 |
commit | 046f264f6b3b2cf7e5a1769fc92335d8a9316282 (patch) | |
tree | d057bb90894e20fcdab6ec737d5f11a040c6d9d0 /fs/btrfs/relocation.c | |
parent | 058a457ef0ce28d595af53d6103db73332383cbc (diff) | |
download | op-kernel-dev-046f264f6b3b2cf7e5a1769fc92335d8a9316282.zip op-kernel-dev-046f264f6b3b2cf7e5a1769fc92335d8a9316282.tar.gz |
Btrfs: Fix null dereference in relocation.c
Fix a potential null dereference in relocation.c
Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Acked-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r-- | fs/btrfs/relocation.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 05d41e5..b37d723 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -784,16 +784,17 @@ again: struct btrfs_extent_ref_v0 *ref0; ref0 = btrfs_item_ptr(eb, path1->slots[0], struct btrfs_extent_ref_v0); - root = find_tree_root(rc, eb, ref0); - if (!root->ref_cows) - cur->cowonly = 1; if (key.objectid == key.offset) { + root = find_tree_root(rc, eb, ref0); if (root && !should_ignore_root(root)) cur->root = root; else list_add(&cur->list, &useless); break; } + if (is_cowonly_root(btrfs_ref_root_v0(eb, + ref0))) + cur->cowonly = 1; } #else BUG_ON(key.type == BTRFS_EXTENT_REF_V0_KEY); |