🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by Hangbin Liu Tue, 20 Oct 2026 01:45
Re: [PATCH] team: fix promisc/allmulti leak in team_port_add error path
#5237
Author: Hangbin Liu
Date: Tue, 20 Oct 2026 01:45
40 lines
9615 bytes
Hi Rongqing,
On Mon, Oct 19, 2026 at 04:31:22PM +0800, lirongqing wrote:
> 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:

I think we can remove the dev_set_promiscuity(port_dev, -1); in
if (dev->flags & IFF_ALLMULTI) and move it under here.


Thanks
Hangbin
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads