* [Qemu-devel] [PATCH v2] 9pfs: fix memory leak in v9fs_write
@ 2016-10-12 13:10 Li Qiang
2016-10-12 14:09 ` Greg Kurz
0 siblings, 1 reply; 2+ messages in thread
From: Li Qiang @ 2016-10-12 13:10 UTC (permalink / raw)
To: groug, qemu-devel; +Cc: Li Qiang
From: Li Qiang <liqiang6-s@360.cn>
If an error occurs when marshal the transfer length to the guest, the
v9fs_write doesn't free an IO vector, thus leading a memory leak.
This patch fix this.
Signed-off-by: Li Qiang <liqiang6-s@360.cn>
---
hw/9pfs/9p.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 8b50bfb..c8cf8c2 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -2090,7 +2090,7 @@ static void v9fs_write(void *opaque)
offset = 7;
err = pdu_marshal(pdu, offset, "d", total);
if (err < 0) {
- goto out;
+ goto out_qiov;
}
err += offset;
trace_v9fs_write_return(pdu->tag, pdu->id, total, err);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH v2] 9pfs: fix memory leak in v9fs_write
2016-10-12 13:10 [Qemu-devel] [PATCH v2] 9pfs: fix memory leak in v9fs_write Li Qiang
@ 2016-10-12 14:09 ` Greg Kurz
0 siblings, 0 replies; 2+ messages in thread
From: Greg Kurz @ 2016-10-12 14:09 UTC (permalink / raw)
To: Li Qiang; +Cc: qemu-devel, Li Qiang
On Wed, 12 Oct 2016 06:10:56 -0700
Li Qiang <liq3ea@gmail.com> wrote:
> From: Li Qiang <liqiang6-s@360.cn>
>
> If an error occurs when marshal the transfer length to the guest, the
> v9fs_write doesn't free an IO vector, thus leading a memory leak.
> This patch fix this.
>
> Signed-off-by: Li Qiang <liqiang6-s@360.cn>
> ---
Good catch again!
Reviewed-by: Greg Kurz <groug@kaod.org>
> hw/9pfs/9p.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
> index 8b50bfb..c8cf8c2 100644
> --- a/hw/9pfs/9p.c
> +++ b/hw/9pfs/9p.c
> @@ -2090,7 +2090,7 @@ static void v9fs_write(void *opaque)
> offset = 7;
> err = pdu_marshal(pdu, offset, "d", total);
> if (err < 0) {
> - goto out;
> + goto out_qiov;
> }
> err += offset;
> trace_v9fs_write_return(pdu->tag, pdu->id, total, err);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-12 14:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-12 13:10 [Qemu-devel] [PATCH v2] 9pfs: fix memory leak in v9fs_write Li Qiang
2016-10-12 14:09 ` Greg Kurz
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).