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] [day] [month] [year] [list]
Message-ID: <6909eb0d.df0a0220.3d8529.c3fb@mx.google.com>
Date: Tue, 4 Nov 2025 13:01:15 +0100
From: Christian Marangi <ansuelsmth@...il.com>
To: Alok Tiwari <alok.a.tiwari@...cle.com>
Cc: hkallweit1@...il.com, andrew@...n.ch, kuba@...nel.org,
	davem@...emloft.net, edumazet@...gle.com, pabeni@...hat.com,
	horms@...nel.org, netdev@...r.kernel.org,
	alok.a.tiwarilinux@...il.com
Subject: Re: [PATCH net] net: mdio: Check regmap pointer returned by
 device_node_to_regmap()

On Fri, Oct 31, 2025 at 09:15:53AM -0700, Alok Tiwari wrote:
> The call to device_node_to_regmap() in airoha_mdio_probe() can return
> an ERR_PTR() if regmap initialization fails. Currently, the driver
> stores the pointer without validation, which could lead to a crash
> if it is later dereferenced.
> 
> Add an IS_ERR() check and return the corresponding error code to make
> the probe path more robust.
> 
> Fixes: 67e3ba978361 ("net: mdio: Add MDIO bus controller for Airoha AN7583")
> Signed-off-by: Alok Tiwari <alok.a.tiwari@...cle.com>

Thanks for taking care. It goes against the schema but yep it's a corner
case that should be handled.

> ---
>  drivers/net/mdio/mdio-airoha.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/mdio/mdio-airoha.c b/drivers/net/mdio/mdio-airoha.c
> index 1dc9939c8d7d..52e7475121ea 100644
> --- a/drivers/net/mdio/mdio-airoha.c
> +++ b/drivers/net/mdio/mdio-airoha.c
> @@ -219,6 +219,8 @@ static int airoha_mdio_probe(struct platform_device *pdev)
>  	priv = bus->priv;
>  	priv->base_addr = addr;
>  	priv->regmap = device_node_to_regmap(dev->parent->of_node);
> +	if (IS_ERR(priv->regmap))
> +		return PTR_ERR(priv->regmap);
>  
>  	priv->clk = devm_clk_get_enabled(dev, NULL);
>  	if (IS_ERR(priv->clk))
> -- 
> 2.50.1
> 

-- 
	Ansuel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ