usb: dwc3: gadget: fix race when disabling ep with cancelled xfers

When disabling an endpoint which has cancelled requests, we should
make sure to giveback requests that are currently pending in the
cancelled list, otherwise we may fall into a situation where command
completion interrupt fires after endpoint has been disabled, therefore
causing a splat.

Fixes: fec9095bdef4 "usb: dwc3: gadget: remove wait_end_transfer"
Reported-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Link: https://lore.kernel.org/r/20191031090713.1452818-1-felipe.balbi@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by Felipe Balbi and committed by Greg Kroah-Hartman d8eca64e 94e259f8

+6
+6
drivers/usb/dwc3/gadget.c
··· 707 708 dwc3_gadget_giveback(dep, req, -ESHUTDOWN); 709 } 710 } 711 712 /**
··· 707 708 dwc3_gadget_giveback(dep, req, -ESHUTDOWN); 709 } 710 + 711 + while (!list_empty(&dep->cancelled_list)) { 712 + req = next_request(&dep->cancelled_list); 713 + 714 + dwc3_gadget_giveback(dep, req, -ESHUTDOWN); 715 + } 716 } 717 718 /**