File CVE-2017-5579-qemuu-serial-host-memory-leakage-in-16550A-UART-emulation.patch of Package xen.11298

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.5.5-testing/tools/qemu-xen-dir-remote/hw/char/serial.c
===================================================================
--- xen-4.5.5-testing.orig/tools/qemu-xen-dir-remote/hw/char/serial.c
+++ xen-4.5.5-testing/tools/qemu-xen-dir-remote/hw/char/serial.c
@@ -667,6 +667,16 @@ void serial_realize_core(SerialState *s,
 void serial_exit_core(SerialState *s)
 {
     qemu_chr_add_handlers(s->chr, NULL, NULL, NULL, NULL);
+
+    timer_del(s->modem_status_poll);
+    timer_free(s->modem_status_poll);
+
+    timer_del(s->fifo_timeout_timer);
+    timer_free(s->fifo_timeout_timer);
+
+    fifo8_destroy(&s->recv_fifo);
+    fifo8_destroy(&s->xmit_fifo);
+
     qemu_unregister_reset(serial_reset, s);
 }
 
openSUSE Build Service is sponsored by