Skip to contentSkip to conversation

qcow2: Fix grow_refcount_table error handling

PATCH New Kevin Wolf 1 participant 1 message Oct 15, 2009 Block layer

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 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).

---
 block/qcow2-refcount.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
block/qcow2-refcount.c +0 -1
index 609eee1..3026678 100644
@@ -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));
     return 0;
  fail:
-    qcow2_free_clusters(bs, table_offset, new_table_size2);
     qemu_free(new_table);
     return -EIO;
 }
Signature · 1 line
1.6.2.5