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