summaryrefslogtreecommitdiff
path: root/drivers/usb/chipidea
diff options
context:
space:
mode:
authorXu Yang <xu.yang_2@nxp.com>2022-06-23 06:02:42 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-06-24 14:45:23 +0300
commitb24346a240b36cfc4df194d145463874985aa29b (patch)
tree73d46d3ddfb5a39f4c49e1c8e500e57a84fe4643 /drivers/usb/chipidea
parent90bc2af24638659da56397ff835f3c95a948f991 (diff)
downloadlinux-b24346a240b36cfc4df194d145463874985aa29b.tar.xz
usb: chipidea: udc: check request status before setting device address
The complete() function may be called even though request is not completed. In this case, it's necessary to check request status so as not to set device address wrongly. Fixes: 10775eb17bee ("usb: chipidea: udc: update gadget states according to ch9") cc: <stable@vger.kernel.org> Signed-off-by: Xu Yang <xu.yang_2@nxp.com> Link: https://lore.kernel.org/r/20220623030242.41796-1-xu.yang_2@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/chipidea')
-rw-r--r--drivers/usb/chipidea/udc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index dc6c96e04bcf..3b8bf6daf7d0 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1048,6 +1048,9 @@ isr_setup_status_complete(struct usb_ep *ep, struct usb_request *req)
struct ci_hdrc *ci = req->context;
unsigned long flags;
+ if (req->status < 0)
+ return;
+
if (ci->setaddr) {
hw_usb_set_address(ci, ci->address);
ci->setaddr = false;