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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 24 Apr 2024 14:13:06 +0300
From: claudiu beznea <claudiu.beznea@...on.dev>
To: Geert Uytterhoeven <geert+renesas@...der.be>,
 Claudiu Beznea <claudiu.beznea.uj@...renesas.com>,
 Sergey Shtylyov <s.shtylyov@....ru>,
 Paul Barker <paul.barker.ct@...renesas.com>,
 Niklas Söderlund <niklas.soderlund+renesas@...natech.se>,
 "David S . Miller" <davem@...emloft.net>, Eric Dumazet
 <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
 Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org, linux-renesas-soc@...r.kernel.org
Subject: Re: [PATCH] net: ravb: Fix registered interrupt names

Hi, Geert,

On 24.04.2024 10:45, Geert Uytterhoeven wrote:
> As interrupts are now requested from ravb_probe(), before calling
> register_netdev(), ndev->name still contains the template "eth%d",
> leading to funny names in /proc/interrupts.  E.g. on R-Car E3:
> 
> 	89:  0      0  GICv2  93 Level  eth%d:ch22:multi
> 	90:  0      3  GICv2  95 Level  eth%d:ch24:emac
> 	91:  0  23484  GICv2  71 Level  eth%d:ch0:rx_be
> 	92:  0      0  GICv2  72 Level  eth%d:ch1:rx_nc
> 	93:  0  13735  GICv2  89 Level  eth%d:ch18:tx_be
> 	94:  0      0  GICv2  90 Level  eth%d:ch19:tx_nc

I failed to notice it, sorry about that.

> 
> Worse, on platforms with multiple RAVB instances (e.g. R-Car V4H), all
> interrupts have similar names.
> 
> Fix this by using the device name instead, like is done in several other
> drivers:
> 
> 	89:  0      0  GICv2  93 Level  e6800000.ethernet:ch22:multi
> 	90:  0      1  GICv2  95 Level  e6800000.ethernet:ch24:emac
> 	91:  0  28578  GICv2  71 Level  e6800000.ethernet:ch0:rx_be
> 	92:  0      0  GICv2  72 Level  e6800000.ethernet:ch1:rx_nc
> 	93:  0  14044  GICv2  89 Level  e6800000.ethernet:ch18:tx_be
> 	94:  0      0  GICv2  90 Level  e6800000.ethernet:ch19:tx_nc
> 
> Rename the local variable dev_name, as it shadows the dev_name()
> function, and pre-initialize it, to simplify the code.
> 
> Fixes: 32f012b8c01ca9fd ("net: ravb: Move getting/requesting IRQs in the probe() method")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@...der.be>

Thank you for taking care of it.

Reviewed-by: Claudiu Beznea <claudiu.beznea.uj@...renesas.com>
Tested-by: Claudiu Beznea <claudiu.beznea.uj@...renesas.com> # on RZ/G3S


> ---
>  drivers/net/ethernet/renesas/ravb_main.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index b621ddd4539cf517..384ddad65aaf641a 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -2729,19 +2729,18 @@ static int ravb_setup_irq(struct ravb_private *priv, const char *irq_name,
>  	struct platform_device *pdev = priv->pdev;
>  	struct net_device *ndev = priv->ndev;
>  	struct device *dev = &pdev->dev;
> -	const char *dev_name;
> +	const char *devname = dev_name(dev);
>  	unsigned long flags;
>  	int error, irq_num;
>  
>  	if (irq_name) {
> -		dev_name = devm_kasprintf(dev, GFP_KERNEL, "%s:%s", ndev->name, ch);
> -		if (!dev_name)
> +		devname = devm_kasprintf(dev, GFP_KERNEL, "%s:%s", devname, ch);
> +		if (!devname)
>  			return -ENOMEM;
>  
>  		irq_num = platform_get_irq_byname(pdev, irq_name);
>  		flags = 0;
>  	} else {
> -		dev_name = ndev->name;
>  		irq_num = platform_get_irq(pdev, 0);
>  		flags = IRQF_SHARED;
>  	}
> @@ -2751,9 +2750,9 @@ static int ravb_setup_irq(struct ravb_private *priv, const char *irq_name,
>  	if (irq)
>  		*irq = irq_num;
>  
> -	error = devm_request_irq(dev, irq_num, handler, flags, dev_name, ndev);
> +	error = devm_request_irq(dev, irq_num, handler, flags, devname, ndev);
>  	if (error)
> -		netdev_err(ndev, "cannot request IRQ %s\n", dev_name);
> +		netdev_err(ndev, "cannot request IRQ %s\n", devname);
>  
>  	return error;
>  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ