usb: chipidea: udc: check request status before setting device address

Bugzilla: http://bugzilla.redhat.com/2084667
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=46653455
Tested: HP ZBook 15 G5/80D5 Laptop

commit b24346a240b36cfc4df194d145463874985aa29b
Author: Xu Yang <xu.yang_2@nxp.com>
Date:   Thu Jun 23 11:02:42 2022 +0800

    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: 10775eb17b ("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>

Signed-off-by: Torez Smith <torez@redhat.com>
This commit is contained in:
Torez Smith 2022-07-25 11:49:14 -04:00
parent 5200f43954
commit d4875b6f4b
1 changed files with 3 additions and 0 deletions

View File

@ -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;