提交 0fd8c3da 编写于 作者: L Liu Bo 提交者: David Sterba

Btrfs: fix panic in balance due to EIO

During build_backref_tree(), if we fail to read a btree node,
we can eventually run into BUG_ON(cache->nr_nodes) that we put
in backref_cache_cleanup(), meaning we have at least one
memory leak.

This frees the backref_node that we's allocated at the very
beginning of build_backref_tree().
Signed-off-by: NLiu Bo <bo.li.liu@oracle.com>
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 baf863b9
......@@ -1171,8 +1171,12 @@ struct backref_node *build_backref_tree(struct reloc_control *rc,
lower = list_entry(useless.next,
struct backref_node, list);
list_del_init(&lower->list);
if (lower == node)
node = NULL;
free_backref_node(cache, lower);
}
free_backref_node(cache, node);
return ERR_PTR(err);
}
ASSERT(!node || !node->detached);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册