From patchwork Wed Jun 20 14:05:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hoffmann, Gerd" X-Patchwork-Id: 166095 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3FA5EB6FC3 for ; Thu, 21 Jun 2012 00:40:30 +1000 (EST) Received: from localhost ([::1]:50582 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShLYE-0007S9-Bj for incoming@patchwork.ozlabs.org; Wed, 20 Jun 2012 10:06:30 -0400 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 Received: from rincewind.home.kraxel.org (ovpn-116-44.ams2.redhat.com [10.36.116.44]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q5KE5a9m004364; Wed, 20 Jun 2012 10:05:37 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 3087940D91; Wed, 20 Jun 2012 16:05:35 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org 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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 6/6] uhci: fix uhci_async_cancel_all X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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);