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-next>] [day] [month] [year] [list]
Message-ID: <20240215072138.GB1256251@nchen-desktop>
Date: Thu, 15 Feb 2024 15:21:38 +0800
From: Peter Chen <peter.chen@...nel.org>
To: Pawel Laszczak <pawell@...ence.com>
Cc: gregkh@...uxfoundation.org, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org, peter.chen@...tech.com,
	stable@...r.kernel.org
Subject: Re: [PATCH] usb: cdnsp: blocked some cdns3 specific code

It is for both cdns3 and cdnsp.

Reply-To: 
In-Reply-To: <20240206104018.48272-1-pawell@...ence.com>

On 24-02-06 11:40:18, Pawel Laszczak wrote:
> host.c file has some parts of code that were introduced for CDNS3 driver
> and should not be used with CDNSP driver.
> This patch blocks using these parts of codes by CDNSP driver.
> These elements include:
> - xhci_plat_cdns3_xhci object
> - cdns3 specific XECP_PORT_CAP_REG register
> - cdns3 specific XECP_AUX_CTRL_REG1 register
> 
> cc: <stable@...r.kernel.org>
> Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")
> Signed-off-by: Pawel Laszczak <pawell@...ence.com>
> ---
>  drivers/usb/cdns3/host.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/cdns3/host.c b/drivers/usb/cdns3/host.c
> index 6164fc4c96a4..ceca4d839dfd 100644
> --- a/drivers/usb/cdns3/host.c
> +++ b/drivers/usb/cdns3/host.c
> @@ -18,6 +18,11 @@
>  #include "../host/xhci.h"
>  #include "../host/xhci-plat.h"
>  
> +/*
> + * The XECP_PORT_CAP_REG and XECP_AUX_CTRL_REG1 exist only
> + * in Cadence USB3 dual-role controller, so it can't be used
> + * with Cadence CDNSP dual-role controller.
> + */
>  #define XECP_PORT_CAP_REG	0x8000
>  #define XECP_AUX_CTRL_REG1	0x8120
>  
> @@ -57,6 +62,8 @@ static const struct xhci_plat_priv xhci_plat_cdns3_xhci = {
>  	.resume_quirk = xhci_cdns3_resume_quirk,
>  };
>  
> +static const struct xhci_plat_priv xhci_plat_cdnsp_xhci;
> +
>  static int __cdns_host_init(struct cdns *cdns)
>  {
>  	struct platform_device *xhci;
> @@ -81,8 +88,13 @@ static int __cdns_host_init(struct cdns *cdns)
>  		goto err1;
>  	}
>  
> -	cdns->xhci_plat_data = kmemdup(&xhci_plat_cdns3_xhci,
> -			sizeof(struct xhci_plat_priv), GFP_KERNEL);
> +	if (cdns->version < CDNSP_CONTROLLER_V2)
> +		cdns->xhci_plat_data = kmemdup(&xhci_plat_cdns3_xhci,
> +				sizeof(struct xhci_plat_priv), GFP_KERNEL);
> +	else
> +		cdns->xhci_plat_data = kmemdup(&xhci_plat_cdnsp_xhci,
> +				sizeof(struct xhci_plat_priv), GFP_KERNEL);
> +

You may explain why you duplicate another structure for cdnsp at commit
log.

>  	if (!cdns->xhci_plat_data) {
>  		ret = -ENOMEM;
>  		goto err1;
> 

Others are okay for me.

-- 

Thanks,
Peter Chen

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ