linux/drivers/net/bonding
Eric Dumazet af602c7aa5 bonding: do not clear curr_active_slave prematurely when releasing all slaves
When releasing all slaves during bond destruction (all == true),
__bond_release_one() unconditionally clears bond->curr_active_slave to
NULL in every iteration.

If a backup slave is released before the active slave,
bond_alb_deinit_slave() triggers rlb_teach_disabled_mac_on_primary(),
which increments the active slave dev promiscuity counter and sets
bond_info->primary_is_promisc = 1.

Because bond->curr_active_slave was prematurely cleared to NULL when
releasing the backup slave, the subsequent iteration releasing the active
slave evaluates oldcurrent as NULL, so bond_change_active_slave(bond, NULL)
is skipped. Consequently, bond_alb_handle_active_change() is never called
to decrement the promiscuity counter, permanently leaking promiscuous
mode on the physical device after bond teardown.

When oldcurrent == slave, bond_change_active_slave(bond, NULL) already sets
bond->curr_active_slave to NULL. We only need to avoid selecting a new
active slave when all == true. Replace the if (all) branch with
if (!all && oldcurrent == slave).

Fixes: 0896341a44 ("bonding: fix bond_release_all inconsistencies")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Jay Vosburgh <jv@jvosburgh.net>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Link: https://patch.msgid.link/20260831203042.164466-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-02 18:19:19 -07:00
..
bond_3ad.c bonding: no longer rely on RTNL in bond_fill_info() 2026-06-30 17:00:03 -07:00
bond_alb.c bonding: alb: fix uninitialized transport header access in alb_determine_nd() 2026-09-01 16:59:21 -07:00
bond_debugfs.c net: bonding: fix NULL deref in bond_debug_rlb_hash_show 2026-03-18 18:05:40 -07:00
bond_main.c bonding: do not clear curr_active_slave prematurely when releasing all slaves 2026-09-02 18:19:19 -07:00
bond_netlink.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-08-18 10:42:41 -07:00
bond_options.c net: bonding: annotate lockless writes with WRITE_ONCE() 2026-09-01 12:26:52 +02:00
bond_procfs.c bonding: annotate data-races in sysfs and procfs 2026-06-04 18:03:07 -07:00
bond_sysfs_slave.c bonding: 3ad: implement proper RCU rules for port->aggregator 2026-04-29 18:32:02 -07:00
bond_sysfs.c bonding: annotate data-races in sysfs and procfs 2026-06-04 18:03:07 -07:00
Makefile