From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2KAx-00077Y-3z for qemu-devel@nongnu.org; Tue, 28 Feb 2012 05:20:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S2KAj-000415-1r for qemu-devel@nongnu.org; Tue, 28 Feb 2012 05:20:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47536) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2KAi-00040Q-PM for qemu-devel@nongnu.org; Tue, 28 Feb 2012 05:20:40 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1SAKdto004993 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 28 Feb 2012 05:20:39 -0500 From: Gerd Hoffmann Date: Tue, 28 Feb 2012 11:20:18 +0100 Message-Id: <1330424430-23015-10-git-send-email-kraxel@redhat.com> In-Reply-To: <1330424430-23015-1-git-send-email-kraxel@redhat.com> References: <1330424430-23015-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 09/21] usb-ehci: sanity-check iso xfers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann This patch adds a sanity check to itd processing to make sure the endpoint addressed by the guest is actually an iso endpoint. Also verify that usb drivers don't return USB_RET_ASYNC which is illegal for iso xfers. Signed-off-by: Gerd Hoffmann --- hw/usb-ehci.c | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c index b9da26a..048eb76 100644 --- a/hw/usb-ehci.c +++ b/hw/usb-ehci.c @@ -1459,12 +1459,16 @@ static int ehci_process_itd(EHCIState *ehci, dev = ehci_find_device(ehci, devaddr); ep = usb_ep_get(dev, pid, endp); - usb_packet_setup(&ehci->ipacket, pid, ep); - usb_packet_map(&ehci->ipacket, &ehci->isgl); - - ret = usb_handle_packet(dev, &ehci->ipacket); - - usb_packet_unmap(&ehci->ipacket); + if (ep->type == USB_ENDPOINT_XFER_ISOC) { + usb_packet_setup(&ehci->ipacket, pid, ep); + usb_packet_map(&ehci->ipacket, &ehci->isgl); + ret = usb_handle_packet(dev, &ehci->ipacket); + assert(ret != USB_RET_ASYNC); + usb_packet_unmap(&ehci->ipacket); + } else { + DPRINTF("ISOCH: attempt to addess non-iso endpoint\n"); + ret = USB_RET_NAK; + } qemu_sglist_destroy(&ehci->isgl); #if 0 -- 1.7.1