Re: [PATCH] usb: chipidea: udc: check request status before setting device address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 22-06-23 11:02:42, Xu Yang wrote:
> The complete() function may be called even though request is not
> completed.

Would you please explain more when the complete() is called but the
request has not completed, and this happens before set_address has
finished?

Peter

> 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@xxxxxxxxxxxxxxx>
> Signed-off-by: Xu Yang <xu.yang_2@xxxxxxx>
> ---
>  drivers/usb/chipidea/udc.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
> index 0c9ae9768a67..8c3e3a635ac2 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;
> -- 
> 2.25.1
> 

-- 

Thanks,
Peter Chen




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux