USB: EHCI: tegra: Fix use-after-free in .remove()
authorTuomas Tynkkynen <ttynkkynen@nvidia.com>
Tue, 17 Jun 2014 14:17:40 +0000 (17:17 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Jul 2014 23:25:22 +0000 (16:25 -0700)
The tegra_ehci_hcd structure is located in the private space allocated
by the core USB code so it must not be accessed after the HCD is
freed.

Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/ehci-tegra.c

index c303371f67bc3e5b9d9c0ea9d0f1c1d785ca2d8d..693f792aa7f5c4019c7cf43c62fed4a99f03d14d 100644 (file)
@@ -479,10 +479,11 @@ static int tegra_ehci_remove(struct platform_device *pdev)
 
        usb_phy_shutdown(hcd->phy);
        usb_remove_hcd(hcd);
-       usb_put_hcd(hcd);
 
        clk_disable_unprepare(tegra->clk);
 
+       usb_put_hcd(hcd);
+
        return 0;
 }