@@ -532,7 +532,7 @@ static int ethtool_set_one_feature(struct net_device *dev,
int __ethtool_set_flags(struct net_device *dev, u32 data)
{
- u32 changed;
+ u32 changed, forced;
if (data & ~flags_dup_features)
return -EINVAL;
@@ -546,7 +546,8 @@ 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;
+ forced = dev->features & ~dev->hw_features;
+ changed = (data ^ forced ^ dev->wanted_features) & flags_dup_features;
if (changed & ~dev->hw_features)
return (changed & dev->hw_features) ? -EINVAL : -EOPNOTSUPP;
__ethtool_set_flags() was not taking into account features set but not user-toggleable. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> --- net/core/ethtool.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)