b1a050a
From e95c9a493a5a8d6f969e86c9f19f80ffe6587e19 Mon Sep 17 00:00:00 2001
b1a050a
From: Li Qiang <liqiang6-s@360.cn>
b1a050a
Date: Mon, 17 Oct 2016 14:13:58 +0200
b1a050a
Subject: [PATCH] 9pfs: fix potential host memory leak in v9fs_read
b1a050a
b1a050a
In 9pfs read dispatch function, it doesn't free two QEMUIOVector
b1a050a
object thus causing potential memory leak. This patch avoid this.
b1a050a
b1a050a
Signed-off-by: Li Qiang <liqiang6-s@360.cn>
b1a050a
Signed-off-by: Greg Kurz <groug@kaod.org>
b1a050a
---
b1a050a
 hw/9pfs/9p.c |    5 +++--
b1a050a
 1 files changed, 3 insertions(+), 2 deletions(-)
b1a050a
b1a050a
diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
b1a050a
index 39a7e1d..ff94a62 100644
b1a050a
--- a/hw/9pfs/virtio-9p.c
b1a050a
+++ b/hw/9pfs/virtio-9p.c
b1a050a
@@ -1826,14 +1826,15 @@ static void v9fs_read(void *opaque)
b1a050a
             if (len < 0) {
b1a050a
                 /* IO error return the error */
b1a050a
                 err = len;
b1a050a
-                goto out;
b1a050a
+                goto out_free_iovec;
b1a050a
             }
b1a050a
         } while (count < max_count && len > 0);
b1a050a
         err = pdu_marshal(pdu, offset, "d", count);
b1a050a
         if (err < 0) {
b1a050a
-            goto out;
b1a050a
+            goto out_free_iovec;
b1a050a
         }
b1a050a
         err += offset + count;
b1a050a
+out_free_iovec:
b1a050a
         qemu_iovec_destroy(&qiov);
b1a050a
         qemu_iovec_destroy(&qiov_full);
b1a050a
     } else if (fidp->fid_type == P9_FID_XATTR) {
b1a050a
-- 
b1a050a
1.7.0.4
b1a050a