Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > media > main-src > by-pkgid > aadbe78a25743146bb784eee19f007c5 > files > 496

kvm-83-164.el5_5.9.src.rpm

From 8e0a7d7018e8056e8bd6395edb6b13c96ee379d0 Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@redhat.com>
Date: Tue, 24 Nov 2009 19:43:07 -0200
Subject: [PATCH 05/11] qcow2: Fix grow_refcount_table error handling

RH-Author: Kevin Wolf <kwolf@redhat.com>
Message-id: <1257858214-16272-1-git-send-email-kwolf@redhat.com>
Patchwork-id: 3695
O-Subject: [RHEL-5.5 KVM PATCH] qcow2: Fix grow_refcount_table error handling
Bugzilla: 537075
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Acked-by: Juan Quintela <quintela@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Gleb Natapov <gleb@redhat.com>

Bugzilla: 520693
Upstream commit: c5baaa489f5557fa01431ba0c5de28b43fc9631e

    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: Kevin Wolf <kwolf@redhat.com>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 qemu/block-qcow2.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 qemu/block-qcow2.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/qemu/block-qcow2.c b/qemu/block-qcow2.c
index a0b3d70..413291f 100644
--- a/qemu/block-qcow2.c
+++ b/qemu/block-qcow2.c
@@ -2560,7 +2560,6 @@ static int grow_refcount_table(BlockDriverState *bs, int min_size)
     free_clusters(bs, old_table_offset, old_table_size * sizeof(uint64_t));
     return 0;
  fail:
-    free_clusters(bs, table_offset, new_table_size2);
     qemu_free(new_table);
     return -EIO;
 }
-- 
1.6.3.rc4.29.g8146