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: <aLl1_AjVZus5wx0M@pie>
Date: Thu, 4 Sep 2025 11:20:28 +0000
From: Yao Zi <ziyao@...root.org>
To: Chaoyi Chen <chaoyi.chen@...k-chips.com>,
	"Russell King (Oracle)" <linux@...linux.org.uk>,
	Simon Horman <horms@...nel.org>
Cc: Andrew Lunn <andrew+netdev@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Jonas Karlman <jonas@...boo.se>, David Wu <david.wu@...k-chips.com>,
	netdev@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org, linux-rockchip@...ts.infradead.org
Subject: Re: [PATCH net] net: stmmac: dwmac-rk: Ensure clk_phy doesn't
 contain invalid address

On Thu, Sep 04, 2025 at 06:58:12PM +0800, Chaoyi Chen wrote:
> 
> On 9/4/2025 6:49 PM, Russell King (Oracle) wrote:
> > On Thu, Sep 04, 2025 at 11:34:43AM +0100, Simon Horman wrote:
> > > Thanks, and sorry for my early confusion about applying this patch.
> > > 
> > > I agree that the bug you point out is addressed by this patch.
> > > Although I wonder if it is cleaner not to set bsp_priv->clk_phy
> > > unless there is no error, rather than setting it then resetting
> > > it if there is an error.
> > +1 !
> > 
> > > More importantly, I wonder if there is another bug: does clk_set_rate need
> > > to be called in the case where there is no error and bsp_priv->integrated_phy
> > > is false?
> > I think there's another issue:
> > 
> > static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat)
> > {
> > ...
> >          if (plat->phy_node) {
> >                  bsp_priv->clk_phy = of_clk_get(plat->phy_node, 0);

This is the only invokation to of_clk_get() in the driver. Should we
convert it to the devres-managed variant? And rk_gmac_remove could be
simplified further.

> > ...
> > 
> > static void rk_gmac_remove(struct platform_device *pdev)
> > {
> > ...
> >          if (priv->plat->phy_node && bsp_priv->integrated_phy)
> >                  clk_put(bsp_priv->clk_phy);
> > 
> > So if bsp_priv->integrated_phy is false, then we get the clock but
> > don't put it.
> 
> Yes! Just remove "bsp_priv->integrated_phy"
> 

Cheers,
Yao Zi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ