From patchwork Mon Feb 15 12:01:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gonglei (Arei)" X-Patchwork-Id: 582863 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 13BAE1402DD for ; Mon, 15 Feb 2016 23:02:27 +1100 (AEDT) Received: from localhost ([::1]:59631 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVHrF-0008TB-60 for incoming@patchwork.ozlabs.org; Mon, 15 Feb 2016 07:02:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVHqy-00089h-EZ for qemu-devel@nongnu.org; Mon, 15 Feb 2016 07:02:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVHqt-0003ge-Ji for qemu-devel@nongnu.org; Mon, 15 Feb 2016 07:02:08 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:50246) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVHqt-0003fX-0f for qemu-devel@nongnu.org; Mon, 15 Feb 2016 07:02:03 -0500 Received: from 172.24.1.47 (EHLO szxeml428-hub.china.huawei.com) ([172.24.1.47]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DBH09361; Mon, 15 Feb 2016 20:01:53 +0800 (CST) Received: from localhost (10.177.18.62) by szxeml428-hub.china.huawei.com (10.82.67.183) with Microsoft SMTP Server id 14.3.235.1; Mon, 15 Feb 2016 20:01:43 +0800 From: Gonglei To: Date: Mon, 15 Feb 2016 20:01:37 +0800 Message-ID: <1455537697-9020-1-git-send-email-arei.gonglei@huawei.com> X-Mailer: git-send-email 2.6.3.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.177.18.62] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.56C1BE32.0265, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: fc24845d6adfc0ea501eff4c041d9f23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.65 Cc: Gonglei , kraxel@redhat.com Subject: [Qemu-devel] [PATCH] usb: drop active assert when pid is invalid 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 pid can be gotten from uhci device memory in uhci_handle_td(), so the guest can trigger assert qemu if we get an invalid pid. And the uhci spec 2.1.2 tells us The Host Controller sets Host Controller Process Error bit to 1 when it detects a fatal error and indicates that the Host Controller suffered a consistency check failure while processing a Transfer Descriptor. An example of a consistency check failure would be finding an illegal PID field while processing the packet header portion of the TD. We'd better to set UHCI_STS_HCPERR and kick an interrupt, but active assert Qemu, which follow the real hardware's spec. [Also fixed BZ 1070027] Signed-off-by: Gonglei --- hw/usb/core.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/usb/core.c b/hw/usb/core.c index bea5e1e..6fbcf00 100644 --- a/hw/usb/core.c +++ b/hw/usb/core.c @@ -716,7 +716,6 @@ struct USBEndpoint *usb_ep_get(USBDevice *dev, int pid, int ep) if (ep == 0) { return &dev->ep_ctl; } - assert(pid == USB_TOKEN_IN || pid == USB_TOKEN_OUT); assert(ep > 0 && ep <= USB_MAX_ENDPOINTS); return eps + ep - 1; }