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: <20241112111639.5261b3cf@kmaincent-XPS-13-7390>
Date: Tue, 12 Nov 2024 11:16:39 +0100
From: Kory Maincent <kory.maincent@...tlin.com>
To: Vadim Fedorenko <vadim.fedorenko@...ux.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>, Claudiu Beznea <claudiu.beznea@...on.dev>,
 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 v19 09/10] net: ethtool: Add support for
 tsconfig command to get/set hwtstamp config

On Sat, 9 Nov 2024 01:43:30 +0000
Vadim Fedorenko <vadim.fedorenko@...ux.dev> wrote:

> > +	ret = net_hwtstamp_validate(&hwtst_config);
> > +	if (ret)
> > +		goto err_clock_put;
> > +
> > +	if (mod) {
> > +		struct kernel_hwtstamp_config zero_config = {0};
> > +		struct hwtstamp_provider *__hwtstamp;
> > +
> > +		/* Disable current time stamping if we try to enable
> > +		 * another one
> > +		 */
> > +		ret = dev_set_hwtstamp_phylib(dev, &zero_config,
> > info->extack);  
> 		
> _hwtst_config is still inited to 0 here, maybe it can be used to avoid
> another stack allocation?

You are right, thanks!

> 
> > +		if (ret < 0)
> > +			goto err_clock_put;
> > +
> > +		/* Change the selected hwtstamp source */
> > +		__hwtstamp = rcu_replace_pointer_rtnl(dev->hwtstamp,
> > hwtstamp);
> > +		if (__hwtstamp)
> > +			call_rcu(&__hwtstamp->rcu_head,
> > +				 remove_hwtstamp_provider);
> > +	} else {
> > +		/* Get current hwtstamp config if we are not changing the
> > +		 * hwtstamp source
> > +		 */
> > +		ret = dev_get_hwtstamp_phylib(dev, &_hwtst_config);  
> 
> This may be tricky whithout ifr set properly. But it should force
> drivers to be converted.

It is the point, it even return not supported error if ndo_hwtstamp_set/get are
not defined.
 
> > +		if (ret < 0 && ret != -EOPNOTSUPP)
> > +			goto err_clock_put;
> > +	}
> > +
> > +	if (memcmp(&hwtst_config, &_hwtst_config, sizeof(hwtst_config))) {
> >  
> 
> better to use kernel_hwtstamp_config_changed() helper here

Oh yes, thanks for pointing it out.

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