Skip to content

Commit

Permalink
net: fix hw_features ethtool_ops->set_flags compatibility
Browse files Browse the repository at this point in the history
__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>
  • Loading branch information
Michał Mirosław authored and David S. Miller committed Apr 22, 2011
1 parent 4700783 commit 5f8629c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/core/ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 5f8629c

Please sign in to comment.