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: <20200718203010.6dg5chsor5rufkaa@skbuf>
Date:   Sat, 18 Jul 2020 23:30:10 +0300
From:   Vladimir Oltean <olteanv@...il.com>
To:     Florian Fainelli <f.fainelli@...il.com>
Cc:     netdev@...r.kernel.org, Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Jiri Pirko <jiri@...lanox.com>,
        Eric Dumazet <edumazet@...gle.com>,
        Taehee Yoo <ap420073@...il.com>,
        Cong Wang <xiyou.wangcong@...il.com>,
        Maxim Mikityanskiy <maximmi@...lanox.com>,
        Richard Cochran <richardcochran@...il.com>,
        Michal Kubecek <mkubecek@...e.cz>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next 1/4] net: Wrap ndo_do_ioctl() to prepare for DSA
 stacked ops

Hi Florian,

On Fri, Jul 17, 2020 at 08:05:30PM -0700, Florian Fainelli wrote:
> In preparation for adding another layer of call into a DSA stacked ops
> singleton, wrap the ndo_do_ioctl() call into dev_do_ioctl().
> 
> Signed-off-by: Florian Fainelli <f.fainelli@...il.com>
> ---

I missed most of the context, but this looks interesting. Am I correct
in saying that this could save us from having to manually pass
phy_mii_ioctl() and that it could be generically handled here?

>  net/core/dev_ioctl.c | 24 +++++++++++++++++-------
>  1 file changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c
> index 547b587c1950..a213c703c90a 100644
> --- a/net/core/dev_ioctl.c
> +++ b/net/core/dev_ioctl.c
> @@ -225,6 +225,22 @@ static int net_hwtstamp_validate(struct ifreq *ifr)
>  	return 0;
>  }
>  
> +static int dev_do_ioctl(struct net_device *dev,
> +			struct ifreq *ifr, unsigned int cmd)
> +{
> +	const struct net_device_ops *ops = dev->netdev_ops;
> +	int err = -EOPNOTSUPP;
> +
> +	if (ops->ndo_do_ioctl) {
> +		if (netif_device_present(dev))
> +			err = ops->ndo_do_ioctl(dev, ifr, cmd);
> +		else
> +			err = -ENODEV;
> +	}
> +
> +	return err;
> +}
> +
>  /*
>   *	Perform the SIOCxIFxxx calls, inside rtnl_lock()
>   */
> @@ -323,13 +339,7 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd)
>  		    cmd == SIOCSHWTSTAMP ||
>  		    cmd == SIOCGHWTSTAMP ||
>  		    cmd == SIOCWANDEV) {
> -			err = -EOPNOTSUPP;
> -			if (ops->ndo_do_ioctl) {
> -				if (netif_device_present(dev))
> -					err = ops->ndo_do_ioctl(dev, ifr, cmd);
> -				else
> -					err = -ENODEV;
> -			}
> +			err = dev_do_ioctl(dev, ifr, cmd);
>  		} else
>  			err = -EINVAL;
>  
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ