On Fri, 11 Sep 2015, Igor Kotrasinski wrote:

> currently, when a zlp flag is set and an urb/usb_request
> buffer is filled without a short packet, transfer() leaves
> its status at -EINPROGRESS and does not rescan for short
> packet.
> 
> In a scenario where ep.maxpacket bytes are copied,
> URB_ZERO_PACKET is set, urb buffer is filled and usb_request
> buffer is not, transfer() returns with an urb with
> -EINPROGRESS status, which dummy_hcd treats as incomplete
> transfer.
> 
> Check for zlp and rescan appropriately.
> 
> Signed-off-by: Igor Kotrasinski <i.kotrasi...@samsung.com>

Acked-by: Alan Stern <st...@rowland.harvard.edu>

I can't believe we missed this for so long...  This should be marked
for -stable.

While you're at it, you might like to clean up a few other things.  For 
example, just before the code changed in this patch we have:

                        ...
                        } else if (to_host) {
                        ...
                        } else if (!to_host) {
                        ...

Obviously the "if (!to_host)" test is unnecessary.

Also, a little above that we have:

                        is_short = (len % ep->ep.maxpacket) != 0;

But at this point we know that len != 0, and we also know that if len
>= ep->ep.maxpacket then in fact len is a multiple of ep->ep.maxpacket.  
Hence the computation can be simplified to:

                        is_short = (len < ep->ep.maxpacket);

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to