* [Qemu-devel] [PATCH] qcow2: Put cache reference in error case
@ 2014-04-04 12:19 Kevin Wolf
2014-04-04 14:43 ` Max Reitz
0 siblings, 1 reply; 2+ messages in thread
From: Kevin Wolf @ 2014-04-04 12:19 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, stefanha
When qcow2_get_cluster_offset() sees a zero cluster in a version 2
image, it (rightfully) returns an error. But in doing so it shouldn't
leak an L2 table cache reference.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/qcow2-cluster.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 65550fd..54946c7 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -495,6 +495,7 @@ int qcow2_get_cluster_offset(BlockDriverState *bs, uint64_t offset,
break;
case QCOW2_CLUSTER_ZERO:
if (s->qcow_version < 3) {
+ qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table);
return -EIO;
}
c = count_contiguous_clusters(nb_clusters, s->cluster_size,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] qcow2: Put cache reference in error case
2014-04-04 12:19 [Qemu-devel] [PATCH] qcow2: Put cache reference in error case Kevin Wolf
@ 2014-04-04 14:43 ` Max Reitz
0 siblings, 0 replies; 2+ messages in thread
From: Max Reitz @ 2014-04-04 14:43 UTC (permalink / raw)
To: Kevin Wolf, qemu-devel; +Cc: stefanha
On 04.04.2014 14:19, Kevin Wolf wrote:
> When qcow2_get_cluster_offset() sees a zero cluster in a version 2
> image, it (rightfully) returns an error. But in doing so it shouldn't
> leak an L2 table cache reference.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> block/qcow2-cluster.c | 1 +
> 1 file changed, 1 insertion(+)
Reviewed-by: Max Reitz <mreitz@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-04-04 14:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-04 12:19 [Qemu-devel] [PATCH] qcow2: Put cache reference in error case Kevin Wolf
2014-04-04 14:43 ` Max Reitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).