summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2021-12-15 11:58:05 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-12-15 23:48:29 +0100
commita1f79504ceb3ffcd2b777e5ac84c97a0948c2dbd (patch)
tree4ff198e19a6f4b16577e4f7ac33c7dc9f6c1f045 /drivers/usb
parenta5b5b45fce2bed5560159095b4777afb18590740 (diff)
downloadlinux-a1f79504ceb3ffcd2b777e5ac84c97a0948c2dbd.tar.bz2
usb: host: xen-hcd: add missing unlock in error path
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> Reviewed-by: Juergen Gross <jgross@suse.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20211215035805.375244-1-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/xen-hcd.c3
1 files changed, 3 insertions, 0 deletions
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;
}