Btrfs: check for NULL pointer in updating reloc roots
authorLiu Bo <bo.li.liu@oracle.com>
Mon, 4 Mar 2013 16:25:36 +0000 (16:25 +0000)
committerJosef Bacik <jbacik@fusionio.com>
Mon, 4 Mar 2013 21:33:22 +0000 (16:33 -0500)
Add a check for NULL pointer to avoid invalid reference.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/relocation.c

index ba5a3210da9a9ce17cd047d9a532cf676ff83125..16e0c6fbdbedcddf27338a76887acc5d114b496e 100644 (file)
@@ -1269,6 +1269,8 @@ static int __update_reloc_root(struct btrfs_root *root, int del)
        }
        spin_unlock(&rc->reloc_root_tree.lock);
 
+       if (!node)
+               return 0;
        BUG_ON((struct btrfs_root *)node->data != root);
 
        if (!del) {