All of lore.kernel.org
 help / color / mirror / Atom feed
From: Piergiorgio Beruto <piergiorgio.beruto@gmail.com>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	Oleksij Rempel <o.rempel@pengutronix.de>
Subject: Re: [PATCH v2 net-next 1/4] net/ethtool: add netlink interface for the PLCA RS
Date: Mon, 5 Dec 2022 10:37:25 +0100	[thread overview]
Message-ID: <Y4271Y9TtdiEgjn2@gvm01> (raw)
In-Reply-To: <Y42509XkIN1S73Er@shell.armlinux.org.uk>

On Mon, Dec 05, 2022 at 09:28:51AM +0000, Russell King (Oracle) wrote:
> On Mon, Dec 05, 2022 at 02:41:35AM +0100, Piergiorgio Beruto wrote:
> > +int ethnl_set_plca_cfg(struct sk_buff *skb, struct genl_info *info)
> > +{
> > +	struct ethnl_req_info req_info = {};
> > +	struct nlattr **tb = info->attrs;
> > +	const struct ethtool_phy_ops *ops;
> > +	struct phy_plca_cfg plca_cfg;
> > +	struct net_device *dev;
> > +
> > +	bool mod = false;
> > +	int ret;
> > +
> > +	ret = ethnl_parse_header_dev_get(&req_info,
> > +					 tb[ETHTOOL_A_PLCA_HEADER],
> > +					 genl_info_net(info), info->extack,
> > +					 true);
> > +	if (ret < 0)
> > +		return ret;
> > +
> > +	dev = req_info.dev;
> > +
> > +	// check that the PHY device is available and connected
> > +	if (!dev->phydev) {
> > +		ret = -EOPNOTSUPP;
> > +		goto out;
> > +	}
> 
> This check should really be done under the RTNL lock. phydevs can come
> and go with SFP cages.
> 
> > +
> > +	rtnl_lock();
Good point Russell, I'll fix that. And I wish to seize the opportunity
to remark that the same problem may be present in cabletest.c
(see below).

Maybe we should post a patch to fix that?

Thanks,
Piergiorgio

int ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info)
{
	struct ethnl_req_info req_info = {};
	const struct ethtool_phy_ops *ops;
	struct nlattr **tb = info->attrs;
	struct net_device *dev;
	int ret;

	ret = ethnl_parse_header_dev_get(&req_info,
					 tb[ETHTOOL_A_CABLE_TEST_HEADER],
					 genl_info_net(info), info->extack,
					 true);
	if (ret < 0)
		return ret;

	dev = req_info.dev;
	if (!dev->phydev) {
		ret = -EOPNOTSUPP;
		goto out_dev_put;
	}

	rtnl_lock();


  reply	other threads:[~2022-12-05  9:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05  1:41 [PATCH v2 net-next 1/4] net/ethtool: add netlink interface for the PLCA RS Piergiorgio Beruto
2022-12-05  1:42 ` [PATCH v2 net-next 2/4] drivers/net/phy: add the link modes for the 10BASE-T1S Ethernet PHY Piergiorgio Beruto
2022-12-05  1:42 ` [PATCH v2 net-next 3/4] drivers/net/phy: add connection between ethtool and phylib for PLCA Piergiorgio Beruto
2022-12-05  1:43 ` [PATCH v2 net-next 4/4] drivers/net/phy: add driver for the onsemi NCN26000 10BASE-T1S PHY Piergiorgio Beruto
2022-12-05  4:50   ` kernel test robot
2022-12-05  6:00 ` [PATCH v2 net-next 1/4] net/ethtool: add netlink interface for the PLCA RS Oleksij Rempel
2022-12-05 10:03   ` Piergiorgio Beruto
2022-12-05 10:22     ` Oleksij Rempel
2022-12-05 14:23       ` Piergiorgio Beruto
2022-12-05 15:31         ` Andrew Lunn
2022-12-05 13:07   ` Andrew Lunn
2022-12-05  9:28 ` Russell King (Oracle)
2022-12-05  9:37   ` Piergiorgio Beruto [this message]
2022-12-05 13:11     ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y4271Y9TtdiEgjn2@gvm01 \
    --to=piergiorgio.beruto@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.