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] [day] [month] [year] [list]
Message-ID: <20230801131254.xzc3xppbwftdj6it@skbuf>
Date: Tue, 1 Aug 2023 16:12:54 +0300
From: Vladimir Oltean <vladimir.oltean@....com>
To: "Russell King (Oracle)" <linux@...linux.org.uk>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Andrew Lunn <andrew@...n.ch>,
	Florian Fainelli <f.fainelli@...il.com>,
	Maxim Georgiev <glipus@...il.com>,
	Horatiu Vultur <horatiu.vultur@...rochip.com>,
	Köry Maincent <kory.maincent@...tlin.com>,
	Maxime Chevallier <maxime.chevallier@...tlin.com>,
	Richard Cochran <richardcochran@...il.com>,
	Vadim Fedorenko <vadim.fedorenko@...ux.dev>,
	Gerhard Engleder <gerhard@...leder-embedded.com>,
	Hangbin Liu <liuhangbin@...il.com>,
	Heiner Kallweit <hkallweit1@...il.com>,
	Jacob Keller <jacob.e.keller@...el.com>,
	Jay Vosburgh <j.vosburgh@...il.com>,
	Andy Gospodarek <andy@...yhouse.net>, Wei Fang <wei.fang@....com>,
	Shenwei Wang <shenwei.wang@....com>,
	Clark Wang <xiaoning.wang@....com>,
	NXP Linux Team <linux-imx@....com>, UNGLinuxDriver@...rochip.com,
	Lars Povlsen <lars.povlsen@...rochip.com>,
	Steen Hegelund <Steen.Hegelund@...rochip.com>,
	Daniel Machon <daniel.machon@...rochip.com>,
	Simon Horman <simon.horman@...igine.com>,
	Casper Andersson <casper.casan@...il.com>,
	Sergey Organov <sorganov@...il.com>,
	Michal Kubecek <mkubecek@...e.cz>,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v8 net-next 06/12] net: fec: convert to
 ndo_hwtstamp_get() and ndo_hwtstamp_set()

On Tue, Jul 18, 2023 at 03:20:13PM +0100, Russell King (Oracle) wrote:
> > +static int fec_hwtstamp_get(struct net_device *ndev,
> > +			    struct kernel_hwtstamp_config *config)
> > +{
> > +	struct fec_enet_private *fep = netdev_priv(ndev);
> > +	struct phy_device *phydev = ndev->phydev;
> > +
> > +	if (phy_has_hwtstamp(phydev))
> > +		return phy_mii_ioctl(phydev, config->ifr, SIOCGHWTSTAMP);
> > +
> > +	if (!fep->bufdesc_ex)
> > +		return -EOPNOTSUPP;
> 
> If the interface hasn't been brought up at least once, then phydev
> here will be NULL, and we'll drop through to this test. If the FEC
> doesn't support extended buffer descriptors, userspace will see
> -EOPNOTSUPP rather than -EINVAL. This could be misleading to userspace.
> 
> Does this need something like:
> 
> 	if (!netif_running(ndev))
> 		return -EINVAL;
> 
> before, or maybe just after phy_has_hwtstamp() to give equivalent
> behaviour?
> 
> > +static int fec_hwtstamp_set(struct net_device *ndev,
> > +			    struct kernel_hwtstamp_config *config,
> > +			    struct netlink_ext_ack *extack)
> > +{
> > +	struct fec_enet_private *fep = netdev_priv(ndev);
> > +	struct phy_device *phydev = ndev->phydev;
> > +
> > +	if (phy_has_hwtstamp(phydev)) {
> > +		fec_ptp_disable_hwts(ndev);
> > +
> > +		return phy_mii_ioctl(phydev, config->ifr, SIOCSHWTSTAMP);
> > +	}
> > +
> > +	if (!fep->bufdesc_ex)
> > +		return -EOPNOTSUPP;
> 
> Same comment here.

I will add back the netif_running() check to continue to not permit the
operation to go through, as before.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ