]> git.proxmox.com Git - pve-qemu.git/blame - debian/patches/extra/0007-virtio-serial-bus-Unset-hotplug-handler-when-unreali.patch
add CVE fixes
[pve-qemu.git] / debian / patches / extra / 0007-virtio-serial-bus-Unset-hotplug-handler-when-unreali.patch
CommitLineData
e74c0f31 1From 691689ab216143f5fefd8e229ffd91086b9a261e Mon Sep 17 00:00:00 2001
90a6d957
WB
2From: Ladi Prosek <lprosek@redhat.com>
3Date: Tue, 30 May 2017 10:59:43 +0200
e74c0f31 4Subject: [PATCH 07/23] virtio-serial-bus: Unset hotplug handler when unrealize
90a6d957
WB
5
6Virtio serial device controls the lifetime of virtio-serial-bus and
7virtio-serial-bus links back to the device via its hotplug-handler
8property. This extra ref-count prevents the device from getting
9finalized, leaving the VirtIODevice memory listener registered and
10leading to use-after-free later on.
11
12This patch addresses the same issue as Fam Zheng's
13"virtio-scsi: Unset hotplug handler when unrealize"
14only for a different virtio device.
15
16Cc: qemu-stable@nongnu.org
17Signed-off-by: Ladi Prosek <lprosek@redhat.com>
18Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
19Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
20Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
21Reviewed-by: Fam Zheng <famz@redhat.com>
22---
23 hw/char/virtio-serial-bus.c | 3 +++
24 1 file changed, 3 insertions(+)
25
26diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
27index d797a6796e..aa9c11ae92 100644
28--- a/hw/char/virtio-serial-bus.c
29+++ b/hw/char/virtio-serial-bus.c
30@@ -1121,6 +1121,9 @@ static void virtio_serial_device_unrealize(DeviceState *dev, Error **errp)
31 timer_free(vser->post_load->timer);
32 g_free(vser->post_load);
33 }
34+
35+ qbus_set_hotplug_handler(BUS(&vser->bus), NULL, errp);
36+
37 virtio_cleanup(vdev);
38 }
39
40--
412.11.0
42