Skip to contentSkip to conversation

usb: xen-hcd: unlock on error paths

PATCH In review Dan Carpenter 2 participants 2 messages Dec 17, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: xen-hcd: unlock on error paths

These error paths are missing unlocks so it will lead to a system hang.

Fixes 494ed3997d75 ("usb: Introduce Xen pvUSB frontend (xen hcd)")
---
 drivers/usb/host/xen-hcd.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/usb/host/xen-hcd.c +3 -0
index 7801dde6f5ee..81adb6be8ee9 100644
@@ -941,6 +941,7 @@ static int xenhcd_urb_request_done(struct xenhcd_info *info)
 
 	rp = info->urb_ring.sring->rsp_prod;
 	if (RING_RESPONSE_PROD_OVERFLOW(&info->urb_ring, rp)) {
+		spin_unlock_irqrestore(&info->lock, flags);
 		xenhcd_set_error(info, "Illegal index on urb-ring");
 		return 0;
 	}
@@ -997,6 +998,7 @@ static int xenhcd_conn_notify(struct xenhcd_info *info)
 	rp = info->conn_ring.sring->rsp_prod;
 	if (RING_RESPONSE_PROD_OVERFLOW(&info->conn_ring, rp)) {
 		xenhcd_set_error(info, "Illegal index on conn-ring");
+		spin_unlock_irqrestore(&info->lock, flags);
 		return 0;
 	}
 	rmb(); /* ensure we see queued responses up to "rp" */
@@ -1010,6 +1012,7 @@ static int xenhcd_conn_notify(struct xenhcd_info *info)
 
 		if (xenhcd_rhport_connect(info, portnum, speed)) {
 			xenhcd_set_error(info, "Illegal data on conn-ring");
+			spin_unlock_irqrestore(&info->lock, flags);
 			return 0;
 		}
 
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 5 lines · Dan Carpenter

These error paths are missing unlocks so it will lead to a system hang.

Fixes 494ed3997d75 ("usb: Introduce Xen pvUSB frontend (xen hcd)")

A similar patch has been queued in the usb-next branch already.

Juergen