]> git.proxmox.com Git - pve-qemu-kvm.git/blame - debian/patches/extra/CVE-2016-9916-9pfs-add-cleanup-operation-for-proxy-backend-driver.patch
bump version to 2.7.1-501
[pve-qemu-kvm.git] / debian / patches / extra / CVE-2016-9916-9pfs-add-cleanup-operation-for-proxy-backend-driver.patch
CommitLineData
f262231e
WB
1From ae9b5c9dae96dd8d3bdf9bb6b9a0f7a2d6f532f7 Mon Sep 17 00:00:00 2001
2From: Li Qiang <liq3ea@gmail.com>
3Date: Wed, 23 Nov 2016 13:53:34 +0100
4Subject: [PATCH 09/12] 9pfs: add cleanup operation for proxy backend driver
5
6In the init operation of proxy backend dirver, it allocates a
7V9fsProxy struct and some other resources. We should free these
8resources when the 9pfs device is unrealized. This is what this
9patch does.
10
11Signed-off-by: Li Qiang <liq3ea@gmail.com>
12Reviewed-by: Greg Kurz <groug@kaod.org>
13Signed-off-by: Greg Kurz <groug@kaod.org>
14---
15 hw/9pfs/9p-proxy.c | 13 +++++++++++++
16 1 file changed, 13 insertions(+)
17
18diff --git a/hw/9pfs/9p-proxy.c b/hw/9pfs/9p-proxy.c
19index f265501..336e9fe 100644
20--- a/hw/9pfs/9p-proxy.c
21+++ b/hw/9pfs/9p-proxy.c
22@@ -1179,9 +1179,22 @@ static int proxy_init(FsContext *ctx)
23 return 0;
24 }
25
26+static void proxy_cleanup(FsContext *ctx)
27+{
28+ V9fsProxy *proxy = ctx->private;
29+
30+ g_free(proxy->out_iovec.iov_base);
31+ g_free(proxy->in_iovec.iov_base);
32+ if (ctx->export_flags & V9FS_PROXY_SOCK_NAME) {
33+ close(proxy->sockfd);
34+ }
35+ g_free(proxy);
36+}
37+
38 FileOperations proxy_ops = {
39 .parse_opts = proxy_parse_opts,
40 .init = proxy_init,
41+ .cleanup = proxy_cleanup,
42 .lstat = proxy_lstat,
43 .readlink = proxy_readlink,
44 .close = proxy_close,
45--
462.1.4
47