File CVE-2017-5579-qemuu-serial-host-memory-leakage-in-16550A-UART-emulation.patch of Package xen.4507
References: bsc#1022627 CVE-2017-5579
The serial_exit_core function doesn't free some resources.
This can lead memory leak when hotplug and unplug. This
patch avoid this.
Signed-off-by: Li Qiang <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/char/serial.c | 10 ++++++++++
1 file changed, 10 insertions(+)
Index: xen-4.4.4-testing/tools/qemu-xen-dir-remote/hw/char/serial.c
===================================================================
--- xen-4.4.4-testing.orig/tools/qemu-xen-dir-remote/hw/char/serial.c
+++ xen-4.4.4-testing/tools/qemu-xen-dir-remote/hw/char/serial.c
@@ -664,6 +664,16 @@ void serial_realize_core(SerialState *s,
void serial_exit_core(SerialState *s)
{
qemu_chr_add_handlers(s->chr, NULL, NULL, NULL, NULL);
+
+ qemu_del_timer(s->modem_status_poll);
+ qemu_free_timer(s->modem_status_poll);
+
+ qemu_del_timer(s->fifo_timeout_timer);
+ qemu_free_timer(s->fifo_timeout_timer);
+
+ fifo8_destroy(&s->recv_fifo);
+ fifo8_destroy(&s->xmit_fifo);
+
qemu_unregister_reset(serial_reset, s);
}