* [Qemu-devel] [PATCH][STABLE] block: Free iovec arrays allocated by multiwrite_merge()
@ 2010-04-21 19:35 Stefan Hajnoczi
2010-04-22 8:38 ` Kevin Wolf
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hajnoczi @ 2010-04-21 19:35 UTC (permalink / raw)
To: qemu-devel
Cc: Anthony Liguori, Stefan Hajnoczi, kvm, Leszek Urbanski,
Marcelo Tosatti, Avi Kivity, Aurelien Jarno
A new iovec array is allocated when creating a merged write request.
This patch ensures that the iovec array is deleted in addition to its
qiov owner.
Reported-by: Leszek Urbanski <tygrys@moo.pl>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
This fixes the virtio-blk memory leak that has recently been reported by Leszek
Urbanski <tygrys@moo.pl>.
The patch should apply to qemu.git and qemu-kvm.git. I'm proposing this patch
for both qemu and qemu-kvm and their stable branches. Sorry if the CCs are
overkill, please let me know so I can follow the process better next time.
block.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/block.c b/block.c
index 0881c93..99dd0f3 100644
--- a/block.c
+++ b/block.c
@@ -1731,6 +1731,9 @@ static void multiwrite_user_cb(MultiwriteCB *mcb)
for (i = 0; i < mcb->num_callbacks; i++) {
mcb->callbacks[i].cb(mcb->callbacks[i].opaque, mcb->error);
+ if (mcb->callbacks[i].free_qiov) {
+ qemu_iovec_destroy(mcb->callbacks[i].free_qiov);
+ }
qemu_free(mcb->callbacks[i].free_qiov);
qemu_vfree(mcb->callbacks[i].free_buf);
}
--
1.7.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH][STABLE] block: Free iovec arrays allocated by multiwrite_merge()
2010-04-21 19:35 [Qemu-devel] [PATCH][STABLE] block: Free iovec arrays allocated by multiwrite_merge() Stefan Hajnoczi
@ 2010-04-22 8:38 ` Kevin Wolf
0 siblings, 0 replies; 2+ messages in thread
From: Kevin Wolf @ 2010-04-22 8:38 UTC (permalink / raw)
To: Stefan Hajnoczi
Cc: Anthony Liguori, kvm, Leszek Urbanski, Marcelo Tosatti,
qemu-devel, Avi Kivity, Aurelien Jarno
Am 21.04.2010 21:35, schrieb Stefan Hajnoczi:
> A new iovec array is allocated when creating a merged write request.
> This patch ensures that the iovec array is deleted in addition to its
> qiov owner.
>
> Reported-by: Leszek Urbanski <tygrys@moo.pl>
> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Picked it up for my block branch, too, but I think this should be
committed immediately by Aurelien.
Kevin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-04-22 8:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-21 19:35 [Qemu-devel] [PATCH][STABLE] block: Free iovec arrays allocated by multiwrite_merge() Stefan Hajnoczi
2010-04-22 8:38 ` Kevin Wolf
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).