aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYan, Zheng <zheng.yan@oracle.com>2010-05-31 04:58:47 -0400
committerChris Mason <chris.mason@oracle.com>2010-06-11 15:48:34 -0400
commit046f264f6b3b2cf7e5a1769fc92335d8a9316282 (patch)
treed057bb90894e20fcdab6ec737d5f11a040c6d9d0
parent058a457ef0ce28d595af53d6103db73332383cbc (diff)
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>
-rw-r--r--fs/btrfs/relocation.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 05d41e569236..b37d723b9d4a 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -784,16 +784,17 @@ again:
784 struct btrfs_extent_ref_v0 *ref0; 784 struct btrfs_extent_ref_v0 *ref0;
785 ref0 = btrfs_item_ptr(eb, path1->slots[0], 785 ref0 = btrfs_item_ptr(eb, path1->slots[0],
786 struct btrfs_extent_ref_v0); 786 struct btrfs_extent_ref_v0);
787 root = find_tree_root(rc, eb, ref0);
788 if (!root->ref_cows)
789 cur->cowonly = 1;
790 if (key.objectid == key.offset) { 787 if (key.objectid == key.offset) {
788 root = find_tree_root(rc, eb, ref0);
791 if (root && !should_ignore_root(root)) 789 if (root && !should_ignore_root(root))
792 cur->root = root; 790 cur->root = root;
793 else 791 else
794 list_add(&cur->list, &useless); 792 list_add(&cur->list, &useless);
795 break; 793 break;
796 } 794 }
795 if (is_cowonly_root(btrfs_ref_root_v0(eb,
796 ref0)))
797 cur->cowonly = 1;
797 } 798 }
798#else 799#else
799 BUG_ON(key.type == BTRFS_EXTENT_REF_V0_KEY); 800 BUG_ON(key.type == BTRFS_EXTENT_REF_V0_KEY);