Skip to content

Commit

Permalink
net/core: ensure features get disabled on new lower devs
Browse files Browse the repository at this point in the history
With moving netdev_sync_lower_features() after the .ndo_set_features
calls, I neglected to verify that devices added *after* a flag had been
disabled on an upper device were properly added with that flag disabled as
well. This currently happens, because we exit __netdev_update_features()
when we see dev->features == features for the upper dev. We can retain the
optimization of leaving without calling .ndo_set_features with a bit of
tweaking and a goto here.

Fixes: fd867d5 ("net/core: generic support for disabling netdev features down stack")
CC: "David S. Miller" <[email protected]>
CC: Eric Dumazet <[email protected]>
CC: Jay Vosburgh <[email protected]>
CC: Veaceslav Falico <[email protected]>
CC: Andy Gospodarek <[email protected]>
CC: Jiri Pirko <[email protected]>
CC: Nikolay Aleksandrov <[email protected]>
CC: Michal Kubecek <[email protected]>
CC: Alexander Duyck <[email protected]>
CC: [email protected]
Reported-by: Nikolay Aleksandrov <[email protected]>
Signed-off-by: Jarod Wilson <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
jarodwilson authored and davem330 committed Nov 5, 2015
1 parent e1b8d90 commit e7868a8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -6402,7 +6402,7 @@ int __netdev_update_features(struct net_device *dev)
struct net_device *upper, *lower;
netdev_features_t features;
struct list_head *iter;
int err = 0;
int err = -1;

ASSERT_RTNL();

Expand All @@ -6419,7 +6419,7 @@ int __netdev_update_features(struct net_device *dev)
features = netdev_sync_upper_features(dev, upper, features);

if (dev->features == features)
return 0;
goto sync_lower;

netdev_dbg(dev, "Features changed: %pNF -> %pNF\n",
&dev->features, &features);
Expand All @@ -6434,6 +6434,7 @@ int __netdev_update_features(struct net_device *dev)
return -1;
}

sync_lower:
/* some features must be disabled on lower devices when disabled
* on an upper device (think: bonding master or bridge)
*/
Expand All @@ -6443,7 +6444,7 @@ int __netdev_update_features(struct net_device *dev)
if (!err)
dev->features = features;

return 1;
return err < 0 ? 0 : 1;
}

/**
Expand Down

0 comments on commit e7868a8

Please sign in to comment.