From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShLXW-0005dd-8J for qemu-devel@nongnu.org; Wed, 20 Jun 2012 10:05:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ShLXP-0000mv-7L for qemu-devel@nongnu.org; Wed, 20 Jun 2012 10:05:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33419) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShLXO-0000lx-Vb for qemu-devel@nongnu.org; Wed, 20 Jun 2012 10:05:39 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q5KE5b6k012776 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 20 Jun 2012 10:05:37 -0400 From: Gerd Hoffmann Date: Wed, 20 Jun 2012 16:05:34 +0200 Message-Id: <1340201134-21109-7-git-send-email-kraxel@redhat.com> In-Reply-To: <1340201134-21109-1-git-send-email-kraxel@redhat.com> References: <1340201134-21109-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 6/6] uhci: fix uhci_async_cancel_all List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: 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 --- hw/usb/hcd-uhci.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index 9871e24..2ebce04 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -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); -- 1.7.1