]> git.proxmox.com Git - qemu.git/commitdiff
uhci: fix uhci_async_cancel_all
authorGerd Hoffmann <kraxel@redhat.com>
Fri, 15 Jun 2012 07:39:50 +0000 (09:39 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Wed, 20 Jun 2012 12:46:02 +0000 (14:46 +0200)
We update the QTAILQ in the loop, thus we must use the SAFE version
to make sure we don't touch the queue struct after freeing it.

https://bugzilla.novell.com/show_bug.cgi?id=766310

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/hcd-uhci.c

index 9871e24f50acda49e24640f179068ad237979505..2ebce04b24e0fc14c270ea05bba25e060d0adf02 100644 (file)
@@ -292,10 +292,10 @@ static void uhci_async_cancel_device(UHCIState *s, USBDevice *dev)
 
 static void uhci_async_cancel_all(UHCIState *s)
 {
-    UHCIQueue *queue;
+    UHCIQueue *queue, *nq;
     UHCIAsync *curr, *n;
 
-    QTAILQ_FOREACH(queue, &s->queues, next) {
+    QTAILQ_FOREACH_SAFE(queue, &s->queues, next, nq) {
         QTAILQ_FOREACH_SAFE(curr, &queue->asyncs, next, n) {
             uhci_async_unlink(curr);
             uhci_async_cancel(curr);