OSDN Git Service

usb: dwc3: gadget: early giveback if End Transfer already completed
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 21 Jan 2019 11:01:16 +0000 (13:01 +0200)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 4 Feb 2019 06:46:01 +0000 (08:46 +0200)
commit9f45581f5eec6786c6eded2b3c85345d82a910c9
tree1165aec166fec9bf1e6926a78a2b0dedfcb6e2d5
parent974a1368c33ebb09c94c9ec1b523908cc7ca068f
usb: dwc3: gadget: early giveback if End Transfer already completed

There is a rare race condition that may happen during a Disconnect
Interrupt if we have a started request that happens to be
dequeued *after* completion of End Transfer command. If that happens,
that request will be left waiting for completion of an End Transfer
command that will never happen.

If End Transfer command has already completed before, we are safe to
giveback the request straight away.

Tested-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc3/gadget.c