From: Gerd Hoffmann Date: Fri, 15 Jun 2012 07:39:50 +0000 (+0200) Subject: uhci: fix uhci_async_cancel_all X-Git-Tag: v1.1.2~64 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f49853a4bd5113cdb847579b8fb171a06d68af10;p=thirdparty%2Fqemu.git uhci: fix uhci_async_cancel_all 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 (cherry picked from commit 77fa9aee38758a078870e25f0dcf642066b4d5cc) Signed-off-by: Michael Roth --- diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index 9e211a0bb4f..3803f526d8c 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -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);