]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[xhci] Fail attempts to issue concurrent commands
authorMichael Brown <mcb30@ipxe.org>
Sun, 3 Jan 2021 19:08:49 +0000 (19:08 +0000)
committerMichael Brown <mcb30@ipxe.org>
Sun, 3 Jan 2021 19:08:49 +0000 (19:08 +0000)
The xHCI driver can handle only a single command TRB in progress at
any one time.  Immediately fail any attempts to issue concurrent
commands (which should not occur in normal operation).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/usb/xhci.c

index 7bc2e356e3c99da26f37a73d34f3252878ba2d77..7c8b2f21cd6a0a3b5d5513c64d4f54f10d15f2bf 100644 (file)
@@ -1813,6 +1813,13 @@ static int xhci_command ( struct xhci_device *xhci, union xhci_trb *trb ) {
        unsigned int i;
        int rc;
 
+       /* Sanity check */
+       if ( xhci->pending != NULL ) {
+               DBGC ( xhci, "XHCI %s command ring busy\n", xhci->name );
+               rc = -EBUSY;
+               goto err_pending;
+       }
+
        /* Record the pending command */
        xhci->pending = trb;
 
@@ -1855,6 +1862,7 @@ static int xhci_command ( struct xhci_device *xhci, union xhci_trb *trb ) {
 
  err_enqueue:
        xhci->pending = NULL;
+ err_pending:
        return rc;
 }