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 <[email protected]>
---
drivers/usb/host/ehci-tegra.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 6fdcb8a..5590567 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -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;
}
--
1.8.1.5
On Tue, 17 Jun 2014, Tuomas Tynkkynen wrote:
> 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 <[email protected]>
> ---
> drivers/usb/host/ehci-tegra.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
> index 6fdcb8a..5590567 100644
> --- a/drivers/usb/host/ehci-tegra.c
> +++ b/drivers/usb/host/ehci-tegra.c
> @@ -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;
> }
Acked-by: Alan Stern <[email protected]>
On 06/17/2014 08:17 AM, Tuomas Tynkkynen wrote:
> 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.
> diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
This seems to be a persistent problem. Witness commit ecc8a0cdca18 "usb:
host: tegra: fix warning messages in ehci_remove". So, I wonder if ...
> @@ -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);
>
It's worth putting a comment here:
/* This must be last, since *tegra is part of *hcd */
> + usb_put_hcd(hcd);
> +
> return 0;
> }
Of course, that could be a separate commit if you want.
On Tue, 17 Jun 2014, Stephen Warren wrote:
> On 06/17/2014 08:17 AM, Tuomas Tynkkynen wrote:
> > 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.
>
> > diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
>
> This seems to be a persistent problem. Witness commit ecc8a0cdca18 "usb:
> host: tegra: fix warning messages in ehci_remove". So, I wonder if ...
>
> > @@ -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);
> >
>
> It's worth putting a comment here:
>
> /* This must be last, since *tegra is part of *hcd */
> > + usb_put_hcd(hcd);
> > +
> > return 0;
> > }
Well, maybe. At this stage it's not too likely that anything will be
added after the usb_put_hcd().
> Of course, that could be a separate commit if you want.
This affects more than ehci-tegra. The same concept applies to all the
EHCI and OHCI platform drivers that use the platform-private area.
Alan Stern