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]
Date:	Mon, 07 Feb 2011 19:46:12 +0000
From:	Ben Hutchings <bhutchings@...arflare.com>
To:	Michał Mirosław <mirq-linux@...e.qmqm.pl>
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH v4 3/5] net: use ndo_fix_features for
 ethtool_ops->set_flags

On Thu, 2011-02-03 at 15:21 +0100, Michał Mirosław wrote:
> Signed-off-by: Michał Mirosław <mirq-linux@...e.qmqm.pl>
> ---
>  net/core/ethtool.c |   31 +++++++++++++++++++++++++++++--
>  1 files changed, 29 insertions(+), 2 deletions(-)
> 
> diff --git a/net/core/ethtool.c b/net/core/ethtool.c
> index 555accf..6e7c6f2 100644
> --- a/net/core/ethtool.c
> +++ b/net/core/ethtool.c
> @@ -240,6 +240,34 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr)
>  	return ret;
>  }
>  
> +static int __ethtool_set_flags(struct net_device *dev, u32 data)
> +{
> +	u32 changed;
> +
> +	if (data & ~flags_dup_features)
> +		return -EINVAL;
> +
> +	/* legacy set_flags() op */
> +	if (dev->ethtool_ops->set_flags) {
> +		if (unlikely(dev->hw_features & flags_dup_features))
> +			netdev_warn(dev,
> +				"driver BUG: mixed hw_features and set_flags()\n");
> +		return dev->ethtool_ops->set_flags(dev, data);
> +	}
> +
> +	/* allow changing only bits set in hw_features */
> +	changed = (data ^ dev->wanted_features) & flags_dup_features;
> +	if (changed & ~dev->hw_features)
> +		return -EOPNOTSUPP;
[...]

The error code should only be EOPNOTSUPP if (dev->hw_features &
flags_dup_features) == 0.  Otherwise it should be EINVAL.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists