Netdev List
 help / color / mirror / Atom feed
* [PATCH] team: fix promisc/allmulti leak in team_port_add error path
@ 2026-10-19  8:31 lirongqing
  2026-10-19  8:38 ` netdev-bot+sinfo
  0 siblings, 1 reply; 2+ messages in thread
From: lirongqing @ 2026-10-19  8:31 UTC (permalink / raw)
  To: Jiri Pirko, Andrew Lunn, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Hangbin Liu, netdev, linux-kernel
  Cc: Li RongQing

From: Li RongQing <lirongqing@baidu.com>

team_port_add() increments the port's promiscuity and allmulti
counts before calling team_dev_type_check_change(). If the latter
fails, the error path does not undo these increments, leaving the
port in promiscuous and allmulti mode even though it was not
successfully added to the team.

Undo both increments in err_set_dev_type, matching the cleanup
performed by team_port_del().

Fixes: 43c2adb9df7d ("team: set slave to promisc if team is already in promisc mode")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 drivers/net/team/team_core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/team/team_core.c b/drivers/net/team/team_core.c
index ca75f08..3b30063 100644
--- a/drivers/net/team/team_core.c
+++ b/drivers/net/team/team_core.c
@@ -1386,6 +1386,10 @@ static int team_port_add(struct team *team, struct net_device *port_dev,
 	return 0;
 
 err_set_dev_type:
+	if (dev->flags & IFF_PROMISC)
+		dev_set_promiscuity(port_dev, -1);
+	if (dev->flags & IFF_ALLMULTI)
+		dev_set_allmulti(port_dev, -1);
 err_set_slave_allmulti:
 err_set_slave_promisc:
 	__team_option_inst_del_port(team, port);
-- 
2.9.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-19  8:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-19  8:31 [PATCH] team: fix promisc/allmulti leak in team_port_add error path lirongqing
2026-10-19  8:38 ` netdev-bot+sinfo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox