linux/drivers/net/team
Ivan Vecera f6988cb63a team: don't call netdev_change_features under team->lock
The team_device_event() notifier calls team_compute_features() to fix
vlan_features under team->lock to protect team->port_list. The problem is
that subsequent __team_compute_features() calls netdev_change_features()
to propagate vlan_features to upper vlan devices while team->lock is still
taken. This can lead to deadlock when NETIF_F_LRO is modified on lower
devices or team device itself.

Example:
The team0 as active backup with eth0 and eth1 NICs. Both eth0 & eth1 are
LRO capable and LRO is enabled. Thus LRO is also enabled on team0.

The command 'ethtool -K team0 lro off' now hangs due to this deadlock:

dev_ethtool()
-> ethtool_set_features()
 -> __netdev_update_features(team)
  -> netdev_sync_lower_features()
   -> netdev_update_features(lower_1)
    -> __netdev_update_features(lower_1)
    -> netdev_features_change(lower_1)
     -> call_netdevice_notifiers(...)
      -> team_device_event(lower_1)
       -> team_compute_features(team) [TAKES team->lock]
        -> netdev_change_features(team)
         -> __netdev_update_features(team)
          -> netdev_sync_lower_features()
           -> netdev_update_features(lower_2)
            -> __netdev_update_features(lower_2)
            -> netdev_features_change(lower_2)
             -> call_netdevice_notifiers(...)
              -> team_device_event(lower_2)
               -> team_compute_features(team) [DEADLOCK]

The bug is present in team from the beginning but it appeared after the commit
fd867d5 (net/core: generic support for disabling netdev features down stack)
that adds synchronization of features with lower devices.

Fixes: fd867d5 (net/core: generic support for disabling netdev features down stack)
Cc: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-05-25 12:58:04 -07:00
..
Kconfig team: introduce random mode 2013-03-06 14:55:20 -05:00
Makefile team: introduce random mode 2013-03-06 14:55:20 -05:00
team.c team: don't call netdev_change_features under team->lock 2016-05-25 12:58:04 -07:00
team_mode_activebackup.c team: fill-up LAG changeupper info struct and pass it along 2015-12-03 11:49:26 -05:00
team_mode_broadcast.c team: fill-up LAG changeupper info struct and pass it along 2015-12-03 11:49:26 -05:00
team_mode_loadbalance.c team: fill-up LAG changeupper info struct and pass it along 2015-12-03 11:49:26 -05:00
team_mode_random.c team: fill-up LAG changeupper info struct and pass it along 2015-12-03 11:49:26 -05:00
team_mode_roundrobin.c team: fill-up LAG changeupper info struct and pass it along 2015-12-03 11:49:26 -05:00