From 44408a983b4563d6483c4346d809c86e59754bfa Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Fri, 14 Mar 2025 12:03:09 +0900 Subject: [PATCH] team: Fix feature exposure when no ports are present BugLink: https://bugs.launchpad.net/bugs/2102266 [ Upstream commit e78c20f327bd94dabac68b98218dff069a8780f0 ] Small follow-up to align this to an equivalent behavior as the bond driver. The change in 3625920b62c3 ("teaming: fix vlan_features computing") removed the netdevice vlan_features when there is no team port attached, yet it leaves the full set of enc_features intact. Instead, leave the default features as pre 3625920b62c3, and recompute once we do have ports attached. Also, similarly as in bonding case, call the netdev_base_features() helper on the enc_features. Fixes: 3625920b62c3 ("teaming: fix vlan_features computing") Signed-off-by: Daniel Borkmann Reviewed-by: Nikolay Aleksandrov Link: https://patch.msgid.link/20241213123657.401868-1-daniel@iogearbox.net Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin [koichiroden: applied to an older path due to missing commit: a0393e3e3ddb ("net: team: rename team to team_core for linking")] Signed-off-by: Koichiro Den Signed-off-by: Mehmet Basaran --- drivers/net/team/team.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 0ba5ac69f7bd..6f614de47cc0 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -997,9 +997,13 @@ static void __team_compute_features(struct team *team) unsigned int dst_release_flag = IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM; - vlan_features = netdev_base_features(vlan_features); - rcu_read_lock(); + if (list_empty(&team->port_list)) + goto done; + + vlan_features = netdev_base_features(vlan_features); + enc_features = netdev_base_features(enc_features); + list_for_each_entry_rcu(port, &team->port_list, list) { vlan_features = netdev_increment_features(vlan_features, port->dev->vlan_features, @@ -1009,11 +1013,11 @@ static void __team_compute_features(struct team *team) port->dev->hw_enc_features, TEAM_ENC_FEATURES); - dst_release_flag &= port->dev->priv_flags; if (port->dev->hard_header_len > max_hard_header_len) max_hard_header_len = port->dev->hard_header_len; } +done: rcu_read_unlock(); team->dev->vlan_features = vlan_features;