浏览代码

Btrfs: check for NULL pointer in updating reloc roots

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>
Liu Bo 12 年之前
父节点
当前提交
8f71f3e0e4
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      fs/btrfs/relocation.c

+ 2 - 0
fs/btrfs/relocation.c

@@ -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) {