Skip to content

Commit 5f8629c

Browse files
osctobedavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4700783 commit 5f8629c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/core/ethtool.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,12 +546,12 @@ int __ethtool_set_flags(struct net_device *dev, u32 data)
546546
}
547547

548548
/* allow changing only bits set in hw_features */
549-
changed = (data ^ dev->wanted_features) & flags_dup_features;
549+
changed = (data ^ dev->features) & flags_dup_features;
550550
if (changed & ~dev->hw_features)
551551
return (changed & dev->hw_features) ? -EINVAL : -EOPNOTSUPP;
552552

553553
dev->wanted_features =
554-
(dev->wanted_features & ~changed) | data;
554+
(dev->wanted_features & ~changed) | (data & dev->hw_features);
555555

556556
__netdev_update_features(dev);
557557

0 commit comments

Comments
 (0)