From 44ee9eef2157ff706ec348f97bdb70b477c9b1b2 Mon Sep 17 00:00:00 2001 From: Jindong Yue Date: Mon, 10 Jul 2023 10:54:40 +0800 Subject: [PATCH] ANDROID: usb: xhci-plat: Fix double-free in xhci_plat_remove Remove the duplicate usb_put_hcd(shared_hcd) to fix following warning when unplugging the usb mouse. ------------[ cut here ]------------ refcount_t: underflow; use-after-free. WARNING: CPU: 4 PID: 153 at lib/refcount.c:28 refcount_warn_saturate+0xf8/0x138 Call trace: refcount_warn_saturate+0xf8/0x138 usb_put_hcd+0xbc/0xc4 xhci_plat_remove+0x124/0x1e4 platform_remove+0x40/0x78 Bug: 290507071 Fixes: 90ab8e7f988d ("ANDROID: usb: host: add xhci hooks for USB offload") Change-Id: Id840b6dcb69600658557c7a33e59c318f66160f5 Signed-off-by: Jindong Yue --- drivers/usb/host/xhci-plat.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index a68493b6f466..42909318609c 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -453,7 +453,6 @@ static int xhci_plat_remove(struct platform_device *dev) xhci_vendor_cleanup(xhci); - usb_put_hcd(shared_hcd); clk_disable_unprepare(clk); clk_disable_unprepare(reg_clk); usb_put_hcd(hcd);