cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
05bba0
From 9c887fdb82a6500aec6897f5c7f48f6bd31a33fc Mon Sep 17 00:00:00 2001
05bba0
From: Max Reitz <mreitz@redhat.com>
05bba0
Date: Sat, 13 Jun 2015 16:21:55 +0200
05bba0
Subject: [PATCH 01/42] qcow2: Put cache reference in error case
05bba0
05bba0
Message-id: <1434212556-3927-2-git-send-email-mreitz@redhat.com>
05bba0
Patchwork-id: 66020
05bba0
O-Subject: [RHEL-7.2 qemu-kvm PATCH 01/42] qcow2: Put cache reference in error case
05bba0
Bugzilla: 1129893
05bba0
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
05bba0
RH-Acked-by: Fam Zheng <famz@redhat.com>
05bba0
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
05bba0
05bba0
From: Kevin Wolf <kwolf@redhat.com>
05bba0
05bba0
BZ: 1129893
05bba0
05bba0
When qcow2_get_cluster_offset() sees a zero cluster in a version 2
05bba0
image, it (rightfully) returns an error. But in doing so it shouldn't
05bba0
leak an L2 table cache reference.
05bba0
05bba0
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
05bba0
Reviewed-by: Max Reitz <mreitz@redhat.com>
05bba0
(cherry picked from commit 8885eadedd0ea8b57c1baa367ee2c2d616700bd9)
05bba0
05bba0
Signed-off-by: Max Reitz <mreitz@redhat.com>
05bba0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
05bba0
---
05bba0
 block/qcow2-cluster.c | 1 +
05bba0
 1 file changed, 1 insertion(+)
05bba0
05bba0
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
05bba0
index 81d90d9..1b9609f 100644
05bba0
--- a/block/qcow2-cluster.c
05bba0
+++ b/block/qcow2-cluster.c
05bba0
@@ -481,6 +481,7 @@ int qcow2_get_cluster_offset(BlockDriverState *bs, uint64_t offset,
05bba0
         break;
05bba0
     case QCOW2_CLUSTER_ZERO:
05bba0
         if (s->qcow_version < 3) {
05bba0
+            qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table);
05bba0
             return -EIO;
05bba0
         }
05bba0
         c = count_contiguous_clusters(nb_clusters, s->cluster_size,
05bba0
-- 
05bba0
1.8.3.1
05bba0