summaryrefslogtreecommitdiff
path: root/net/core/ethtool.c
diff options
context:
space:
mode:
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>2011-04-21 17:59:21 +0400
committerDavid S. Miller <davem@davemloft.net>2011-04-22 04:21:43 +0400
commit5f8629c526b4f7e529a6d27bbd802c0dc7fcc357 (patch)
treecab14d913c195769820bfe3a9fe08325e67cf96b /net/core/ethtool.c
parent470078312515f12e7cd916f1bd002acad313b9c8 (diff)
downloadlinux-5f8629c526b4f7e529a6d27bbd802c0dc7fcc357.tar.xz
net: fix hw_features ethtool_ops->set_flags compatibility
__ethtool_set_flags() was not taking into account features set but not user-toggleable. Since GFLAGS returns masked dev->features, EINVAL is returned when passed flags differ to it, and not to wanted_features. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/ethtool.c')
-rw-r--r--net/core/ethtool.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 13d79f5a86e5..d8b1a8d85a96 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -546,12 +546,12 @@ int __ethtool_set_flags(struct net_device *dev, u32 data)
}
/* allow changing only bits set in hw_features */
- changed = (data ^ dev->wanted_features) & flags_dup_features;
+ changed = (data ^ dev->features) & flags_dup_features;
if (changed & ~dev->hw_features)
return (changed & dev->hw_features) ? -EINVAL : -EOPNOTSUPP;
dev->wanted_features =
- (dev->wanted_features & ~changed) | data;
+ (dev->wanted_features & ~changed) | (data & dev->hw_features);
__netdev_update_features(dev);