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: <20250117130656.23a41605@kmaincent-XPS-13-7390>
Date: Fri, 17 Jan 2025 13:06:56 +0100
From: Kory Maincent <kory.maincent@...tlin.com>
To: Claudiu Beznea <claudiu.beznea@...on.dev>
Cc: Florian Fainelli <florian.fainelli@...adcom.com>, Broadcom internal
 kernel review list <bcm-kernel-feedback-list@...adcom.com>, Andrew Lunn
 <andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>, Russell King
 <linux@...linux.org.uk>, "David S. Miller" <davem@...emloft.net>, Eric
 Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo
 Abeni <pabeni@...hat.com>, Richard Cochran <richardcochran@...il.com>, Radu
 Pirea <radu-nicolae.pirea@....nxp.com>, Jay Vosburgh
 <j.vosburgh@...il.com>, Andy Gospodarek <andy@...yhouse.net>, Nicolas Ferre
 <nicolas.ferre@...rochip.com>, Willem de Bruijn
 <willemdebruijn.kernel@...il.com>, Jonathan Corbet <corbet@....net>,
 Horatiu Vultur <horatiu.vultur@...rochip.com>,
 UNGLinuxDriver@...rochip.com, Simon Horman <horms@...nel.org>, Vladimir
 Oltean <vladimir.oltean@....com>, donald.hunter@...il.com,
 danieller@...dia.com, ecree.xilinx@...il.com, Andrew Lunn
 <andrew+netdev@...n.ch>, Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
 linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
 linux-doc@...r.kernel.org, Maxime Chevallier
 <maxime.chevallier@...tlin.com>, Rahul Rameshbabu <rrameshbabu@...dia.com>,
 Willem de Bruijn <willemb@...gle.com>, Shannon Nelson
 <shannon.nelson@....com>, Alexandra Winter <wintera@...ux.ibm.com>
Subject: Re: [PATCH net-next v21 3/5] net: Add the possibility to support a
 selected hwtstamp in netdevice

On Fri, 17 Jan 2025 13:57:41 +0200
Claudiu Beznea <claudiu.beznea@...on.dev> wrote:

> Hi, Kory,
> 
> On 12.12.2024 19:06, Kory Maincent wrote:
> > Introduce the description of a hwtstamp provider, mainly defined with a
> > the hwtstamp source and the phydev pointer.
> > 
> > Add a hwtstamp provider description within the netdev structure to
> > allow saving the hwtstamp we want to use. This prepares for future
> > support of an ethtool netlink command to select the desired hwtstamp
> > provider. By default, the old API that does not support hwtstamp
> > selectability is used, meaning the hwtstamp provider pointer is unset.
> > 
> > Signed-off-by: Kory Maincent <kory.maincent@...tlin.com>  
> 
> I'm getting this error when doing suspend/resume on the Renesas RZ/G3S
> Smarc Module + RZ SMARC Carrier II board:
> 
> [   39.032969] =============================
> [   39.032983] WARNING: suspicious RCU usage
> [   39.033000] 6.13.0-rc7-next-20250116-arm64-renesas-00002-g35245dfdc62c
> #7 Not tainted
> [   39.033019] -----------------------------
> [   39.033033] drivers/net/phy/phy_device.c:2004 suspicious
> rcu_dereference_protected() usage!

Thanks for the report.
Oh so it seems there are cases where phy_detach is not called under RTNL lock!

This should solve the issue:
-               hwprov = rtnl_dereference(dev->hwprov);
+               rcu_read_lock()
+               hwprov = rcu_dereference(dev->hwprov);
                /* Disable timestamp if it is the one selected */
                if (hwprov && hwprov->phydev == phydev) {
                        rcu_assign_pointer(dev->hwprov, NULL);
                        kfree_rcu(hwprov, rcu_head);
                }
+               rcu_read_unlock();

I will send a patch soon.

Regards,
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ