From patchwork Fri Aug 17 09:39:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 178178 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 5EC582C0087 for ; Fri, 17 Aug 2012 19:38:58 +1000 (EST) Received: from localhost ([::1]:46587 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2J16-0003kz-FW for incoming@patchwork.ozlabs.org; Fri, 17 Aug 2012 05:38:56 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2J0X-0002Rw-OK for qemu-devel@nongnu.org; Fri, 17 Aug 2012 05:38:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T2J0T-0002IF-5a for qemu-devel@nongnu.org; Fri, 17 Aug 2012 05:38:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41737) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2J0S-0002I8-U4 for qemu-devel@nongnu.org; Fri, 17 Aug 2012 05:38:17 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q7H9cGBl028769 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 17 Aug 2012 05:38:16 -0400 Received: from shalem.localdomain.com (vpn1-6-112.ams2.redhat.com [10.36.6.112]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q7H9cDJD007975; Fri, 17 Aug 2012 05:38:15 -0400 From: Hans de Goede To: Gerd Hoffmann Date: Fri, 17 Aug 2012 11:39:16 +0200 Message-Id: <1345196357-6076-2-git-send-email-hdegoede@redhat.com> In-Reply-To: <1345196357-6076-1-git-send-email-hdegoede@redhat.com> References: <1345196357-6076-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Hans de Goede , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 2/3] usb: controllers do not need to check for babble themselves 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 If an (emulated) usb-device tries to write more data to a packet then its iov len, this will trigger an assert in usb_packet_copy(), and if a driver somehow circumvents that check and writes more data to the iov then there is space, we have a much bigger problem then not correctly reporting babble to the guest. In practice babble will only happen with (real) redirected devices, and there both the usb-host os and the qemu usb-device code already check for it. Signed-off-by: Hans de Goede --- hw/usb/hcd-ehci.c | 4 ---- hw/usb/hcd-uhci.c | 5 ----- 2 files changed, 9 deletions(-) diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index a6b8527..4750175 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -1460,10 +1460,6 @@ static void ehci_execute_complete(EHCIQueue *q) assert(0); break; } - } else if ((p->usb_status > p->tbytes) && (p->pid == USB_TOKEN_IN)) { - p->usb_status = USB_RET_BABBLE; - q->qh.token |= (QTD_TOKEN_HALT | QTD_TOKEN_BABBLE); - ehci_raise_irq(q->ehci, USBSTS_ERRINT); } else { // TODO check 4.12 for splits diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index 8987734..4e43d20 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -729,11 +729,6 @@ static int uhci_complete_td(UHCIState *s, UHCI_TD *td, UHCIAsync *async, uint32_ *int_mask |= 0x01; if (pid == USB_TOKEN_IN) { - if (len > max_len) { - ret = USB_RET_BABBLE; - goto out; - } - if ((td->ctrl & TD_CTRL_SPD) && len < max_len) { *int_mask |= 0x02; /* short packet: do not update QH */