lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YmwGPDNXNfx2RqLY@rowland.harvard.edu>
Date:   Fri, 29 Apr 2022 11:37:32 -0400
From:   Alan Stern <stern@...land.harvard.edu>
To:     Vincent Shih <vincent.sunplus@...il.com>
Cc:     gregkh@...uxfoundation.org, p.zabel@...gutronix.de,
        davem@...emloft.net, vladimir.oltean@....com,
        linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org,
        robh+dt@...nel.org, krzysztof.kozlowski+dt@...aro.org,
        devicetree@...r.kernel.org, wells.lu@...plus.com
Subject: Re: [PATCH v4 1/2] usb: host: ehci-sunplus: Add driver for ehci in
 Sunplus SP7021

On Fri, Apr 29, 2022 at 04:27:55PM +0800, Vincent Shih wrote:
> Add driver for ehci in Sunplus SP7021
> 
> Signed-off-by: Vincent Shih <vincent.sunplus@...il.com>
> ---
> Changes in v4:
>   - Implement power_on, power_off and power_suspend functions.

Did you test these?  Did you try to rmmod the ehci-sunplus module after 
adding these functions?

> diff --git a/drivers/usb/host/ehci-sunplus.c b/drivers/usb/host/ehci-sunplus.c
> new file mode 100644
> index 0000000..4d8e20d
> --- /dev/null
> +++ b/drivers/usb/host/ehci-sunplus.c
> @@ -0,0 +1,289 @@

...

> +static void sp_ehci_platform_power_off(struct platform_device *pdev)
> +{
> +	struct usb_hcd *hcd = platform_get_drvdata(pdev);
> +	struct sp_ehci_priv *sp_priv = hcd_to_sp_ehci_priv(hcd);
> +
> +	phy_power_off(sp_priv->phy);
> +	phy_exit(sp_priv->phy);

Notice that this dereferences a field contained in the sp_ehci_priv 
extension to the usb_hcd structure.

...

> +static int ehci_sunplus_remove(struct platform_device *pdev)
> +{
> +	struct usb_hcd *hcd = platform_get_drvdata(pdev);
> +	struct usb_ehci_pdata *pdata = pdev->dev.platform_data;
> +
> +	usb_remove_hcd(hcd);
> +	usb_put_hcd(hcd);

This call deallocates the usb_hcd structure.

> +
> +	if (pdata->power_off)
> +		pdata->power_off(pdev);

But here you dereference a field that it contains.  This power-off 
operation must occur _before_ the usb_put_hcd() call.

Alan Stern

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ