linux/drivers/usb/renesas_usbhs
Yoshihiro Shimoda b2357839c5 usb: renesas_usbhs: add a workaround for a race condition of workqueue
The old commit 6e4b74e469 ("usb: renesas: fix scheduling in atomic
context bug") fixed an atomic issue by using workqueue for the shdmac
dmaengine driver. However, this has a potential race condition issue
between the work pending and usbhsg_ep_free_request() in gadget mode.
When usbhsg_ep_free_request() is called while pending the queue,
since the work_struct will be freed and then the work handler is
called, kernel panic happens on process_one_work().

To fix the issue, if we could call cancel_work_sync() at somewhere
before the free request, it could be easy. However,
the usbhsg_ep_free_request() is called on atomic (e.g. f_ncm driver
calls free request via gether_disconnect()).

For now, almost all users are having "USB-DMAC" and the DMAengine
driver can be used on atomic. So, this patch adds a workaround for
a race condition to call the DMAengine APIs without the workqueue.

This means we still have TODO on shdmac environment (SH7724), but
since it doesn't have SMP, the race condition might not happen.

Fixes: ab330cf388 ("usb: renesas_usbhs: add support for USB-DMAC")
Cc: <stable@vger.kernel.org> # v4.1+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2019-07-03 11:00:50 +03:00
..
common.c usb: renesas_usbhs: remove controlling PWEN/EXTLP support 2019-06-05 11:54:38 +02:00
common.h usb: renesas_usbhs: add support for CNEN bit 2019-05-21 10:25:59 +02:00
fifo.c usb: renesas_usbhs: add a workaround for a race condition of workqueue 2019-07-03 11:00:50 +03:00
fifo.h USB: renesas_usbhs: Remove redundant license text 2017-11-07 15:45:01 +01:00
Kconfig usb: remove redundant 'default n' from Kconfig-s 2019-05-21 10:06:22 +02:00
Makefile usb: renesas_usbhs: Add support for RZ/A2 2019-05-21 10:25:59 +02:00
mod_gadget.c USB: mark expected switch fall-throughs 2018-07-02 18:08:19 +02:00
mod_host.c USB: renesas_usbhs: fix spelling mistake "doens't" -> "doesn't" 2019-02-19 14:41:38 +01:00
mod.c USB: renesas_usbhs: Remove redundant license text 2017-11-07 15:45:01 +01:00
mod.h USB: renesas_usbhs: Remove redundant license text 2017-11-07 15:45:01 +01:00
pipe.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
pipe.h usb: renesas_usbhs: add usbhs_pipe_clear_without_sequence() function 2017-12-12 13:04:09 +02:00
rcar2.c USB: renesas_usbhs: drop unused legacy-phy support 2018-04-22 15:58:24 +02:00
rcar2.h USB: renesas_usbhs: rcar?.h: add SPDX tags 2017-11-07 15:53:48 +01:00
rcar3.c usb: renesas_usbhs: replace udelay() with usleep_range() 2019-01-18 10:00:49 +01:00
rcar3.h USB: renesas_usbhs: rcar?.h: add SPDX tags 2017-11-07 15:53:48 +01:00
rza2.c usb: renesas_usbhs: Add support for RZ/A2 2019-05-21 10:25:59 +02:00
rza.c usb: renesas_usbhs: replace udelay() with usleep_range() 2019-01-18 10:00:49 +01:00
rza.h usb: renesas_usbhs: Add support for RZ/A2 2019-05-21 10:25:59 +02:00