Patchwork [4/4] virtio-serial: delete timer if active during exit

login
register
mail settings
Submitter Amit Shah
Date Dec. 13, 2012, 10:37 a.m.
Message ID <a75bf146503a94fb900e0dfa0529bd5d1be9fec5.1355394885.git.amit.shah@redhat.com>
Download mbox | patch
Permalink /patch/205805/
State New
Headers show

Comments

Amit Shah - Dec. 13, 2012, 10:37 a.m.
The post_load timer was being freed, but not deleted.  This could cause
problems when the timer is armed, but the device is hot-unplugged before
the callback is executed.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 hw/virtio-serial-bus.c | 1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index 09d4659..fc0166c 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -1038,6 +1038,7 @@  void virtio_serial_exit(VirtIODevice *vdev)
     g_free(vser->ports_map);
     if (vser->post_load) {
         g_free(vser->post_load->connected);
+        qemu_del_timer(vser->post_load->timer);
         qemu_free_timer(vser->post_load->timer);
         g_free(vser->post_load);
     }