[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] audio: es1370: unregister reset call on exit

From: P J P
Subject: [Qemu-devel] [PATCH] audio: es1370: unregister reset call on exit
Date: Wed, 23 Nov 2016 15:05:00 +0530

From: Prasad J Pandit <address@hidden>

ES1370 audio device emulator registers a device reset call with
Qemu during initialisation. But the same is not unregistered when
audio device is unplugged. This leads to a use-after-free error
during reboot, as Qemu resets the machine. Add 'es1370_exit'
PCIDeviceClass method to avoid it.

Reported-by: Huawei PSIRT <address@hidden>
Signed-off-by: Prasad J Pandit <address@hidden>
 hw/audio/es1370.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c
index 8449b5f..5c97295 100644
--- a/hw/audio/es1370.c
+++ b/hw/audio/es1370.c
@@ -1047,12 +1047,19 @@ static int es1370_init (PCIBus *bus)
     return 0;
+static void es1370_exit (PCIDevice *dev)
+    ES1370State *s = ES1370(dev);
+    qemu_unregister_reset(es1370_on_reset, s);
 static void es1370_class_init (ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS (klass);
     PCIDeviceClass *k = PCI_DEVICE_CLASS (klass);
     k->realize = es1370_realize;
+    k->exit = es1370_exit;
     k->vendor_id = PCI_VENDOR_ID_ENSONIQ;
     k->device_id = PCI_DEVICE_ID_ENSONIQ_ES1370;
     k->class_id = PCI_CLASS_MULTIMEDIA_AUDIO;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]