]> git.ipfire.org Git - thirdparty/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)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 21 Aug 2012 20:36:35 +0000 (15:36 -0500)
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>
(cherry picked from commit 77fa9aee38758a078870e25f0dcf642066b4d5cc)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/usb/hcd-uhci.c

index 9e211a0bb4f8242d0f947fe9fedbf439350a89d7..3803f526d8c41c77308e088d8454d96354879373 100644 (file)
@@ -288,10 +288,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);