From 586b723733904c0825844582dd19a44c71bc972b Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Sat, 4 Jul 2020 11:52:26 +0100 Subject: [PATCH] [usb] Leave port enabled after a failed device registration A failure in device registration (e.g. due to a device with malformed descriptors) will currently result in the port being disabled as part of the error path. This in turn causes the hardware to detect the device as newly connected, leading to an endless loop of failed device registrations. Fix by leaving the port enabled in the case of a registration failure. Signed-off-by: Michael Brown --- src/drivers/bus/usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/drivers/bus/usb.c b/src/drivers/bus/usb.c index d18751c66..a7b687528 100644 --- a/src/drivers/bus/usb.c +++ b/src/drivers/bus/usb.c @@ -1615,7 +1615,9 @@ static int register_usb ( struct usb_device *usb ) { usb->host->close ( usb ); err_open: err_speed: - hub->driver->disable ( hub, port ); + /* Leave port enabled on failure, to avoid an endless loop of + * failed device registrations. + */ err_enable: list_del ( &usb->list ); port->usb = NULL;