[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 02/12] 9pfs: fix potential host memory leak in v9fs_r
From: |
Greg Kurz |
Subject: |
[Qemu-devel] [PULL 02/12] 9pfs: fix potential host memory leak in v9fs_read |
Date: |
Mon, 17 Oct 2016 17:05:44 +0200 |
From: Li Qiang <address@hidden>
In 9pfs read dispatch function, it doesn't free two QEMUIOVector
object thus causing potential memory leak. This patch avoid this.
Signed-off-by: Li Qiang <address@hidden>
Signed-off-by: Greg Kurz <address@hidden>
---
hw/9pfs/9p.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 39a7e1d52d2a..ff94a6272c3c 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -1826,14 +1826,15 @@ static void v9fs_read(void *opaque)
if (len < 0) {
/* IO error return the error */
err = len;
- goto out;
+ goto out_free_iovec;
}
} while (count < max_count && len > 0);
err = pdu_marshal(pdu, offset, "d", count);
if (err < 0) {
- goto out;
+ goto out_free_iovec;
}
err += offset + count;
+out_free_iovec:
qemu_iovec_destroy(&qiov);
qemu_iovec_destroy(&qiov_full);
} else if (fidp->fid_type == P9_FID_XATTR) {
--
2.5.5
- [Qemu-devel] [PULL 00/12] 9p patches for 2.8 20161017, Greg Kurz, 2016/10/17
- [Qemu-devel] [PULL 02/12] 9pfs: fix potential host memory leak in v9fs_read,
Greg Kurz <=
- [Qemu-devel] [PULL 01/12] 9pfs: allocate space for guest originated empty strings, Greg Kurz, 2016/10/17
- [Qemu-devel] [PULL 06/12] 9pfs: drop useless check in pdu_free(), Greg Kurz, 2016/10/17
- [Qemu-devel] [PULL 05/12] 9pfs: use coroutine_fn annotation in hw/9pfs/9p.[ch], Greg Kurz, 2016/10/17
- [Qemu-devel] [PULL 04/12] 9pfs: use coroutine_fn annotation in hw/9pfs/co*.[ch], Greg Kurz, 2016/10/17
- [Qemu-devel] [PULL 03/12] 9pfs: fsdev: drop useless extern annotation for functions, Greg Kurz, 2016/10/17
- [Qemu-devel] [PULL 08/12] virtio-9p: add reset handler, Greg Kurz, 2016/10/17
- [Qemu-devel] [PULL 07/12] 9pfs: only free completed request if not flushed, Greg Kurz, 2016/10/17
- [Qemu-devel] [PULL 11/12] 9pfs: fix memory leak in v9fs_link, Greg Kurz, 2016/10/17
- [Qemu-devel] [PULL 10/12] 9pfs: fix memory leak in v9fs_xattrcreate, Greg Kurz, 2016/10/17
- [Qemu-devel] [PULL 09/12] 9pfs: fix information leak in xattr read, Greg Kurz, 2016/10/17