From owner-svn-src-stable@freebsd.org Thu Jul 16 02:53:13 2020 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E3B853514AE; Thu, 16 Jul 2020 02:53:13 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B6f2K5h3Gz3bp6; Thu, 16 Jul 2020 02:53:13 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A661C21887; Thu, 16 Jul 2020 02:53:13 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 06G2rD2I028345; Thu, 16 Jul 2020 02:53:13 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 06G2rD17028344; Thu, 16 Jul 2020 02:53:13 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <202007160253.06G2rD17028344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Thu, 16 Jul 2020 02:53:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363239 - stable/12/usr.sbin/bhyve X-SVN-Group: stable-12 X-SVN-Commit-Author: grehan X-SVN-Commit-Paths: stable/12/usr.sbin/bhyve X-SVN-Commit-Revision: 363239 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jul 2020 02:53:14 -0000 Author: grehan Date: Thu Jul 16 02:53:13 2020 New Revision: 363239 URL: https://svnweb.freebsd.org/changeset/base/363239 Log: MFC r362644 Prevent calling USB backends multiple times. Modified: stable/12/usr.sbin/bhyve/pci_xhci.c stable/12/usr.sbin/bhyve/usb_mouse.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/pci_xhci.c ============================================================================== --- stable/12/usr.sbin/bhyve/pci_xhci.c Wed Jul 15 22:42:50 2020 (r363238) +++ stable/12/usr.sbin/bhyve/pci_xhci.c Thu Jul 16 02:53:13 2020 (r363239) @@ -1838,6 +1838,9 @@ retry: DPRINTF(("pci_xhci[%d]: xfer->ndata %u", __LINE__, xfer->ndata)); + if (xfer->ndata <= 0) + goto errout; + if (epid == 1) { err = USB_ERR_NOT_STARTED; if (dev->dev_ue->ue_request != NULL) @@ -1852,6 +1855,7 @@ retry: err = USB_TO_XHCI_ERR(err); if ((err == XHCI_TRB_ERROR_SUCCESS) || + (err == XHCI_TRB_ERROR_STALL) || (err == XHCI_TRB_ERROR_SHORT_PKT)) { err = pci_xhci_xfer_complete(sc, xfer, slot, epid, &do_intr); if (err != XHCI_TRB_ERROR_SUCCESS) Modified: stable/12/usr.sbin/bhyve/usb_mouse.c ============================================================================== --- stable/12/usr.sbin/bhyve/usb_mouse.c Wed Jul 15 22:42:50 2020 (r363238) +++ stable/12/usr.sbin/bhyve/usb_mouse.c Thu Jul 16 02:53:13 2020 (r363239) @@ -388,7 +388,7 @@ umouse_request(void *scarg, struct usb_data_xfer *xfer "sizeof(umouse_dev_desc) %lu", len, sizeof(umouse_dev_desc))); if ((value & 0xFF) != 0) { - err = USB_ERR_IOERROR; + err = USB_ERR_STALLED; goto done; } if (len > sizeof(umouse_dev_desc)) { @@ -403,7 +403,7 @@ umouse_request(void *scarg, struct usb_data_xfer *xfer case UDESC_CONFIG: DPRINTF(("umouse: (->UDESC_CONFIG)")); if ((value & 0xFF) != 0) { - err = USB_ERR_IOERROR; + err = USB_ERR_STALLED; goto done; } if (len > sizeof(umouse_confd)) { @@ -472,7 +472,7 @@ umouse_request(void *scarg, struct usb_data_xfer *xfer default: DPRINTF(("umouse: unknown(%d)->ERROR", value >> 8)); - err = USB_ERR_IOERROR; + err = USB_ERR_STALLED; goto done; } eshort = data->blen > 0; @@ -496,7 +496,7 @@ umouse_request(void *scarg, struct usb_data_xfer *xfer break; default: DPRINTF(("umouse: IO ERROR")); - err = USB_ERR_IOERROR; + err = USB_ERR_STALLED; goto done; } eshort = data->blen > 0; @@ -507,7 +507,7 @@ umouse_request(void *scarg, struct usb_data_xfer *xfer if (index != 0) { DPRINTF(("umouse get_interface, invalid index %d", index)); - err = USB_ERR_IOERROR; + err = USB_ERR_STALLED; goto done; } @@ -578,7 +578,7 @@ umouse_request(void *scarg, struct usb_data_xfer *xfer case UREQ(UR_SET_FEATURE, UT_WRITE_INTERFACE): case UREQ(UR_SET_FEATURE, UT_WRITE_ENDPOINT): DPRINTF(("umouse: (UR_CLEAR_FEATURE, UT_WRITE_INTERFACE)")); - err = USB_ERR_IOERROR; + err = USB_ERR_STALLED; goto done; case UREQ(UR_SET_INTERFACE, UT_WRITE_INTERFACE): @@ -617,7 +617,7 @@ umouse_request(void *scarg, struct usb_data_xfer *xfer memcpy(data->buf, &sc->um_report, len); data->bdone += len; } else { - err = USB_ERR_IOERROR; + err = USB_ERR_STALLED; goto done; } eshort = data->blen > 0; @@ -659,7 +659,7 @@ umouse_request(void *scarg, struct usb_data_xfer *xfer default: DPRINTF(("**** umouse request unhandled")); - err = USB_ERR_IOERROR; + err = USB_ERR_STALLED; break; }