]> git.proxmox.com Git - pve-qemu-kvm.git/blame - debian/patches/extra/CVE-2016-9915-9pfs-add-cleanup-operation-for-handle-backend-driver.patch
bump version to 2.7.1-501
[pve-qemu-kvm.git] / debian / patches / extra / CVE-2016-9915-9pfs-add-cleanup-operation-for-handle-backend-driver.patch
CommitLineData
f262231e
WB
1From 4196726e44c437793294af15d95e53164cf9a02d Mon Sep 17 00:00:00 2001
2From: Li Qiang <liq3ea@gmail.com>
3Date: Wed, 23 Nov 2016 13:53:34 +0100
4Subject: [PATCH 08/12] 9pfs: add cleanup operation for handle backend driver
5
6In the init operation of handle backend dirver, it allocates a
7handle_data struct and opens a mount file. 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-handle.c | 9 +++++++++
16 1 file changed, 9 insertions(+)
17
18diff --git a/hw/9pfs/9p-handle.c b/hw/9pfs/9p-handle.c
19index 3d77594..1687661 100644
20--- a/hw/9pfs/9p-handle.c
21+++ b/hw/9pfs/9p-handle.c
22@@ -649,6 +649,14 @@ out:
23 return ret;
24 }
25
26+static void handle_cleanup(FsContext *ctx)
27+{
28+ struct handle_data *data = ctx->private;
29+
30+ close(data->mountfd);
31+ g_free(data);
32+}
33+
34 static int handle_parse_opts(QemuOpts *opts, struct FsDriverEntry *fse)
35 {
36 const char *sec_model = qemu_opt_get(opts, "security_model");
37@@ -671,6 +679,7 @@ static int handle_parse_opts(QemuOpts *opts, struct FsDriverEntry *fse)
38 FileOperations handle_ops = {
39 .parse_opts = handle_parse_opts,
40 .init = handle_init,
41+ .cleanup = handle_cleanup,
42 .lstat = handle_lstat,
43 .readlink = handle_readlink,
44 .close = handle_close,
45--
462.1.4
47