usb: phy: twl6030-usb: fix possible use-after-free on remove
diff mbox series

Message ID
State Accepted
Commit 5895d311d28f2605e2f71c1a3e043ed38f3ac9d2
Headers show
  • usb: phy: twl6030-usb: fix possible use-after-free on remove
Related show

Commit Message

Sven Van Asbroeck Feb. 11, 2019, 3:04 p.m. UTC
In remove(), use cancel_delayed_work_sync() to cancel the
delayed work. Otherwise there's a chance that this work
will continue to run until after the device has been removed.

This issue was detected with the help of Coccinelle.

Cc: Tony Lindgren <>
Cc: Bin Liu <>
Fixes: b6a619a883c3 ("usb: phy: Check initial state for twl6030")
Signed-off-by: Sven Van Asbroeck <>
 drivers/usb/phy/phy-twl6030-usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff mbox series

diff --git a/drivers/usb/phy/phy-twl6030-usb.c b/drivers/usb/phy/phy-twl6030-usb.c
index 183550b63faa..dade34d70419 100644
--- a/drivers/usb/phy/phy-twl6030-usb.c
+++ b/drivers/usb/phy/phy-twl6030-usb.c
@@ -400,7 +400,7 @@  static int twl6030_usb_remove(struct platform_device *pdev)
 	struct twl6030_usb *twl = platform_get_drvdata(pdev);
-	cancel_delayed_work(&twl->get_status_work);
+	cancel_delayed_work_sync(&twl->get_status_work);