linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] usb: host: xen-hcd: add missing unlock in error path
@ 2021-12-15  3:58 Yang Yingliang
  2021-12-15  8:50 ` Juergen Gross
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2021-12-15  3:58 UTC (permalink / raw)
  To: linux-kernel, linux-usb; +Cc: jgross, gregkh

Add the missing unlock before return from function xenhcd_urb_request_done()
and xenhcd_conn_notify() in the error handling case.

Fixes: 494ed3997d75 ("usb: Introduce Xen pvUSB frontend (xen hcd)")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/usb/host/xen-hcd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/host/xen-hcd.c b/drivers/usb/host/xen-hcd.c
index 7801dde6f5ee..be09fd9bac58 100644
--- a/drivers/usb/host/xen-hcd.c
+++ b/drivers/usb/host/xen-hcd.c
@@ -942,6 +942,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)) {
 		xenhcd_set_error(info, "Illegal index on urb-ring");
+		spin_unlock_irqrestore(&info->lock, flags);
 		return 0;
 	}
 	rmb(); /* ensure we see queued responses up to "rp" */
@@ -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;
 		}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] usb: host: xen-hcd: add missing unlock in error path
  2021-12-15  3:58 [PATCH -next] usb: host: xen-hcd: add missing unlock in error path Yang Yingliang
@ 2021-12-15  8:50 ` Juergen Gross
  0 siblings, 0 replies; 2+ messages in thread
From: Juergen Gross @ 2021-12-15  8:50 UTC (permalink / raw)
  To: Yang Yingliang, linux-kernel, linux-usb; +Cc: gregkh


[-- Attachment #1.1.1: Type: text/plain, Size: 432 bytes --]

On 15.12.21 04:58, Yang Yingliang wrote:
> Add the missing unlock before return from function xenhcd_urb_request_done()
> and xenhcd_conn_notify() in the error handling case.
> 
> Fixes: 494ed3997d75 ("usb: Introduce Xen pvUSB frontend (xen hcd)")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Reviewed-by: Juergen Gross <jgross@suse.com>


Thanks,

Juergen

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3135 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-15  8:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-15  3:58 [PATCH -next] usb: host: xen-hcd: add missing unlock in error path Yang Yingliang
2021-12-15  8:50 ` Juergen Gross

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).