提交 c5baaa48 编写于 作者: K Kevin Wolf 提交者: Anthony Liguori

qcow2: Fix grow_refcount_table error handling

In case of failure, we haven't increased the refcount for the newly allocated
cluster yet. Therefore we must not free the cluster or its refcount will become
negative (and endless recursion is possible).
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 dcc7e25f
...@@ -182,7 +182,6 @@ static int grow_refcount_table(BlockDriverState *bs, int min_size) ...@@ -182,7 +182,6 @@ static int grow_refcount_table(BlockDriverState *bs, int min_size)
qcow2_free_clusters(bs, old_table_offset, old_table_size * sizeof(uint64_t)); qcow2_free_clusters(bs, old_table_offset, old_table_size * sizeof(uint64_t));
return 0; return 0;
fail: fail:
qcow2_free_clusters(bs, table_offset, new_table_size2);
qemu_free(new_table); qemu_free(new_table);
return -EIO; return -EIO;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册