From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3ruW-0007Le-QL for qemu-devel@nongnu.org; Tue, 21 Aug 2012 13:06:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T3ruV-0002ka-Kv for qemu-devel@nongnu.org; Tue, 21 Aug 2012 13:06:36 -0400 Received: from mail-yw0-f45.google.com ([209.85.213.45]:52626) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3ruV-0002kQ-GX for qemu-devel@nongnu.org; Tue, 21 Aug 2012 13:06:35 -0400 Received: by yhpp34 with SMTP id p34so35187yhp.4 for ; Tue, 21 Aug 2012 10:06:35 -0700 (PDT) Sender: fluxion From: Michael Roth Date: Tue, 21 Aug 2012 12:05:44 -0500 Message-Id: <1345568757-14365-11-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1345568757-14365-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1345568757-14365-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 10/23] uhci: fix uhci_async_cancel_all List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com From: Gerd Hoffmann 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 --- hw/usb/hcd-uhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index 9e211a0..3803f52 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); -- 1.7.9.5