浏览代码

Btrfs: avoid NULL pointer deref in try_release_extent_buffer

If we fail to find a pointer in the radix tree, don't try
to deref the NULL one we do have.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
Chris Mason 14 年之前
父节点
当前提交
45f49bce99
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      fs/btrfs/extent_io.c

+ 4 - 2
fs/btrfs/extent_io.c

@@ -3837,8 +3837,10 @@ int try_release_extent_buffer(struct extent_io_tree *tree, struct page *page)
 
 	spin_lock(&tree->buffer_lock);
 	eb = radix_tree_lookup(&tree->buffer, start >> PAGE_CACHE_SHIFT);
-	if (!eb)
-		goto out;
+	if (!eb) {
+		spin_unlock(&tree->buffer_lock);
+		return ret;
+	}
 
 	if (test_bit(EXTENT_BUFFER_DIRTY, &eb->bflags)) {
 		ret = 0;