Skip to content

Commit f6988cb

Browse files
iveceradavem330
authored andcommitted
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 <[email protected]> Signed-off-by: Ivan Vecera <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f58fb33 commit f6988cb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/net/team/team.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ static void team_port_disable(struct team *team,
990990
#define TEAM_ENC_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
991991
NETIF_F_RXCSUM | NETIF_F_ALL_TSO)
992992

993-
static void __team_compute_features(struct team *team)
993+
static void ___team_compute_features(struct team *team)
994994
{
995995
struct team_port *port;
996996
u32 vlan_features = TEAM_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL;
@@ -1021,15 +1021,20 @@ static void __team_compute_features(struct team *team)
10211021
team->dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
10221022
if (dst_release_flag == (IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM))
10231023
team->dev->priv_flags |= IFF_XMIT_DST_RELEASE;
1024+
}
10241025

1026+
static void __team_compute_features(struct team *team)
1027+
{
1028+
___team_compute_features(team);
10251029
netdev_change_features(team->dev);
10261030
}
10271031

10281032
static void team_compute_features(struct team *team)
10291033
{
10301034
mutex_lock(&team->lock);
1031-
__team_compute_features(team);
1035+
___team_compute_features(team);
10321036
mutex_unlock(&team->lock);
1037+
netdev_change_features(team->dev);
10331038
}
10341039

10351040
static int team_port_enter(struct team *team, struct team_port *port)

0 commit comments

Comments
 (0)