]> git.baikalelectronics.ru Git - kernel.git/commit
usb: dwc3: omap: fix race of pm runtime with irq handler in probe
authorGrygorii Strashko <grygorii.strashko@ti.com>
Mon, 12 Dec 2016 19:37:52 +0000 (13:37 -0600)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 2 Jan 2017 08:55:28 +0000 (10:55 +0200)
commit1101d417f010c4a910eb09af6f7f41a86fa286ee
tree9e934f0f717a56749d70766a005ac6118afa7366
parent11fea91e81f75c3280e82e864a7a1ba6d350f7cd
usb: dwc3: omap: fix race of pm runtime with irq handler in probe

Now races can happen between interrupt handler execution and PM runtime in
error handling code path in probe and in dwc3_omap_remove() which will lead
to system crash:

in probe:
...
 err1:
pm_runtime_put_sync(dev);
^^ PM runtime can race with IRQ handler when deferred probing happening
   due to extcon
pm_runtime_disable(dev);

return ret;

in dwc3_omap_remove:
...
dwc3_omap_disable_irqs(omap);
^^ IRQs are disabled in HW, but handler may still run
of_platform_depopulate(omap->dev);
pm_runtime_put_sync(&pdev->dev);
^^ PM runtime can race with IRQ handler
pm_runtime_disable(&pdev->dev);

return 0;

So, OMAP DWC3 IRQ need to be disabled before calling
pm_runtime_put() in probe and in dwc3_omap_remove().

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc3/dwc3-omap.c