linux/drivers/usb/dwc3
Mayank Rana 05645366f3 usb: dwc3: gadget: Fix list_del corruption in dwc3_ep_dequeue
dwc3_ep_dequeue() waits for completion of End Transfer command using
wait_event_lock_irq(), which will release the dwc3->lock while waiting
and reacquire after completion. This allows a potential race condition
with ep_disable() which also removes all requests from started_list
and pending_list.

The check for NULL r->trb should catch this but currently it exits to
the wrong 'out1' label which calls dwc3_gadget_giveback(). Since its
list entry was already removed, if CONFIG_DEBUG_LIST is enabled a
'list_del corruption' bug is thrown since its next/prev pointers are
already LIST_POISON1/2. If r->trb is NULL it should simply exit to
'out0'.

Fixes: cf3113d893 ("usb: dwc3: gadget: properly increment dequeue pointer on ep_dequeue")
Cc: stable@vger.kernel.org # v4.12+
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-05-21 10:36:14 +03:00
..
core.c usb: dwc3: support clocks and resets for DWC3 core 2018-05-16 08:52:39 +03:00
core.h usb: dwc3: gadget: remove duplicated missed isoc handling 2018-05-21 10:00:53 +03:00
debug.h usb: dwc3: debug: decode uFrame from event too 2018-05-21 10:00:59 +03:00
debugfs.c usb: dwc3: Dump LSP and BMU debug info 2018-03-22 10:49:02 +02:00
drd.c usb: dwc3: dwc3_get_extcon() can be static 2018-05-21 10:01:01 +03:00
dwc3-exynos.c USB: dwc3: Remove redundant license text 2017-11-07 15:45:01 +01:00
dwc3-keystone.c USB: dwc3: Remove redundant license text 2017-11-07 15:45:01 +01:00
dwc3-of-simple.c usb: dwc3: Add Qualcomm DWC3 glue driver 2018-05-15 10:20:13 +03:00
dwc3-omap.c usb: dwc3: omap: don't miss events during suspend/resume 2018-02-12 10:53:18 +02:00
dwc3-pci.c usb: dwc3: pci: Properly cleanup resource 2018-03-22 10:48:18 +02:00
dwc3-qcom.c usb: dwc3: Add Qualcomm DWC3 glue driver 2018-05-15 10:20:13 +03:00
dwc3-st.c USB: dwc3: Remove redundant license text 2017-11-07 15:45:01 +01:00
ep0.c usb: dwc3: gadget: initialize transfer index from send_gadget_ep_cmd() 2018-05-21 10:01:01 +03:00
gadget.c usb: dwc3: gadget: Fix list_del corruption in dwc3_ep_dequeue 2018-05-21 10:36:14 +03:00
gadget.h usb: dwc3: gadget: assign resource_index inside get_transfer_index() 2018-05-21 10:01:00 +03:00
host.c USB: dwc3: Remove redundant license text 2017-11-07 15:45:01 +01:00
io.h USB: dwc3: Remove redundant license text 2017-11-07 15:45:01 +01:00
Kconfig usb: dwc3: Add Qualcomm DWC3 glue driver 2018-05-15 10:20:13 +03:00
Makefile usb: dwc3: Add Qualcomm DWC3 glue driver 2018-05-15 10:20:13 +03:00
trace.c USB: dwc3: Remove redundant license text 2017-11-07 15:45:01 +01:00
trace.h usb: dwc3: gadget: remove duplicated missed isoc handling 2018-05-21 10:00:53 +03:00
ulpi.c USB: dwc3: Remove redundant license text 2017-11-07 15:45:01 +01:00