linux/drivers/net/bonding
Xiang Mei (Microsoft) 683c6ba6e5 bonding: alb: re-check primary_is_promisc under RTNL in bond_alb_monitor
bond_alb_monitor() reads primary_is_promisc under RCU, then drops RCU and
takes RTNL via rtnl_trylock() before undoing the promiscuity it set on the
active slave. In that window the active slave can change under RTNL
(RTM_DELLINK -> __bond_release_one() -> bond_alb_handle_active_change()),
which already drops the promiscuity and clears primary_is_promisc. The
monitor still acts on the stale decision: if the slave was removed with no
failover, curr_active_slave is now NULL and the deref faults; if it failed
over, the stale dev_set_promiscuity(-1) underflows the new slave's
promiscuity counter and pins it in IFF_PROMISC.

  Oops: general protection fault, probably for non-canonical address ...
  KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
  Workqueue: b42 bond_alb_monitor
  RIP: 0010:bond_alb_monitor (drivers/net/bonding/bond_alb.c:1600)
   process_one_work (kernel/workqueue.c:3322)
   worker_thread (kernel/workqueue.c:3486)
   kthread (kernel/kthread.c:436)
   ret_from_fork (arch/x86/kernel/process.c:158)
  Kernel panic - not syncing: Fatal exception

Re-check primary_is_promisc (and curr_active_slave) after taking RTNL so
the monitor only undoes an increment it still owns. The other bonding
monitors already re-read state under RTNL in their commit phase
(bond_miimon_commit/bond_ab_arp_commit); bond_alb_monitor() was the only
one acting on the pre-trylock decision.

Fixes: d0e81b7e22 ("bonding: Acquire correct locks in alb for promisc change")
Reported-by: AutonomousCodeSecurity@microsoft.com
Signed-off-by: Xiang Mei (Microsoft) <xmei5@asu.edu>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Acked-by: Jay Vosburgh <jv@jvosburgh.net>
Link: https://patch.msgid.link/20260725233930.2957317-1-xmei5@asu.edu
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-07-30 16:16:48 -07:00
..
bond_3ad.c bonding: 3ad: fix mux port state on oper down 2026-06-10 07:53:36 -07:00
bond_alb.c bonding: alb: re-check primary_is_promisc under RTNL in bond_alb_monitor 2026-07-30 16:16:48 -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: fix devconf_all NULL dereference when IPv6 is disabled 2026-07-20 18:18:02 -07:00
bond_netlink.c bonding: 3ad: add lacp_strict configuration knob 2026-06-10 07:53:26 -07:00
bond_options.c bonding: 3ad: fix carrier when no usable slaves 2026-06-10 07:53:33 -07: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