From nobody Sat Jul 25 01:54:11 2026 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C58633CB907 for ; Mon, 20 Jul 2026 22:34:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784586849; cv=none; b=p/9YvgRUL2+X6j5WPTUPi2iqPe2WbnKkJt2Sa14IpeTGvKSSSpGayc4Zlyo7hx6hWY5yowCKAqnGhYFNY2QPZlKv5P4HQvObWN1K11qBcYitnFNc+IxoFVl2V5lj2TP+VAVbtdY0kAxlWrdZrVMBybhP/8rawOf1qhyeAiybEjM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784586849; c=relaxed/simple; bh=dlRjBnXzN6CQJk18cJLEFzwZk6Rv5Ax2epHDma2e/ek=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=SAjabDlgXh+M1Rf/mhnsY8lhcNLHVi1AFBldhmUnMjj7aUlPmqzXDrsA4W/DCalj3PCRkLjyi2iyDLUgUluDBvkvZTrybH+kq1yGeH6zj6zc+CdwlaTeS8kywo06MCUlpB3xG6ZPP6oRW9zOgvT8dOZemzNP3QjSLAWT7HqvDc8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=asu.edu; spf=pass smtp.mailfrom=asu.edu; dkim=pass (2048-bit key) header.d=asu.edu header.i=@asu.edu header.b=VIFdlGyH; arc=none smtp.client-ip=209.85.214.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=asu.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=asu.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=asu.edu header.i=@asu.edu header.b="VIFdlGyH" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2caced6038eso59340915ad.0 for ; Mon, 20 Jul 2026 15:34:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=asu.edu; s=google; t=1784586845; x=1785191645; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=A2TPUjqiIPkxhL/mDAlf7qxw7OdM1Z6fcLVNvTrXGec=; b=VIFdlGyH5ElzE7oTSew/PZyiF/g0KFjzrGiQkSXxWT9Zqsu1q6aHa5w7HuLF2jYz7C jXavQCe14xjUNpahTrtctvndpWd0u4YMuwNsLmWlnaOPZEJes8P6dptsNIwPPJL/wJdM UsL3+RYcMziqVuPtQ13xVdrTLu9qfiJbdqPNBHlXHgoRATvdLcybmA2SaYhhwlzS5buj /zKDFHL4H3mMovaNCSvnH+uYeeI82bgBlJ2BcLPQl64ByI+IlAuvOZWoVBOhB3RafudW khwkXlSDQ0W+yMWxYd1GeN/VVKIAfcmD9GjolgGuWVcAwndcCLsyd6vyRptSYz53k6rb Hjcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784586845; x=1785191645; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=A2TPUjqiIPkxhL/mDAlf7qxw7OdM1Z6fcLVNvTrXGec=; b=AdndIRbfOsieVafy6HxXiw/puOTbzP69NwV82TNOeJBICvNLttmoZMCTu4x/y8KAp4 mZF3ULe3IWaGntzz5/ZXmZtZMIT9rTkO44YTQHPLBnR54aFwEUL6qjmsUL0SMxnw42dq c26sEnDWbbepO/WfbmHAuXXGpLFP1ly7DajyuxAlE7yNkmw9aZY2T9IXWrlior0aJbeG 2/9qmrDqX4nako8/D/s/83Ih0B0XfvNmbNLDHEBanRsCLxP1N88SlAlZ6kx+aNI8/O4j HGJzjVYgTLnokKpOPoTFAZkojufF8rSCnuLGAtnBofC6OfT4optV6pNoveyh7x3BbFKF hhQQ== X-Forwarded-Encrypted: i=1; AHgh+Rp0yp4eVjaNMIy5HfePKNGYwSW529DghwihQvXe4OB5y6g+JCbsDYRQ455Tj1mcA7LaYa6GPeK1gMlRoW0=@vger.kernel.org X-Gm-Message-State: AOJu0YyWPqTAkNyXxG1ePMzpnsVfnCttT3hmei15/49EopLzTVrmWIzg tb3apv23wGJCffhQqvkrgsT77XircOxfdYELemR7EZ9qyy5S4Lf5/l2EZhmtc6ahFQ== X-Gm-Gg: AR+sD12DoL/tBVUzOI/YbLIpagvHHo8yYc0FYmhzVcUpP8vIOhFJt2kQW76YESnYUEB s0XalYu/kK3YYzzMglNAwpysfoL2Wk0ZfLF3z+MkVrNqt6ErdQo98y+EtBrGLnC3ScHIW8LesIL g5VD6/Lp7aUvGEYdhIfuh0Fe6ciquPbZL+TBvnu1yxyIh8BVAnBVuJvPxnnyNFAsQYDjR1gHAv9 +/2GFbBBqYC/sf/evi7FNkSjsAOX3PEVYvylW8aKb0WvJ/TZ4aFL2dHIPsfHDW7HmDBJGnYDAHm wlnhX6yBepPBao8pOyq3xKw9b2iAxtsU43qzbdyZqwUq2YfN3n0ZuLf8I+peXEB+4OHNVZ+P67J EEjwVqWC8VpPf2R1nuiRFoMIuqN7P8RVGaRn12QL392evvbzeBvSCjVy45QTXpofohRdpKptH90 AAzc0gcq/KMs2A6SLeDA== X-Received: by 2002:a17:903:2ac6:b0:2ce:a6a4:451b with SMTP id d9443c01a7336-2cf1f2e71eamr219797525ad.11.1784586845226; Mon, 20 Jul 2026 15:34:05 -0700 (PDT) Received: from xiang.tailc0aff1.ts.net ([20.171.14.70]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31429f9bcd9sm41078761eec.3.2026.07.20.15.34.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2026 15:34:04 -0700 (PDT) From: "Xiang Mei (Microsoft)" To: Jay Vosburgh , Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, AutonomousCodeSecurity@microsoft.com, tgopinath@linux.microsoft.com, kys@microsoft.com, "Xiang Mei (Microsoft)" Subject: [PATCH net] bonding: alb: re-check primary_is_promisc under RTNL in bond_alb_monitor Date: Mon, 20 Jul 2026 22:34:00 +0000 Message-ID: <20260720223400.1939998-1-xmei5@asu.edu> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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: d0e81b7e2246 ("bonding: Acquire correct locks in alb for promisc cha= nge") Reported-by: AutonomousCodeSecurity@microsoft.com Signed-off-by: Xiang Mei (Microsoft) --- drivers/net/bonding/bond_alb.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 2d37b07c8215..70458c5b23cc 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c @@ -1535,7 +1535,7 @@ void bond_alb_monitor(struct work_struct *work) alb_work.work); struct alb_bond_info *bond_info =3D &(BOND_ALB_INFO(bond)); struct list_head *iter; - struct slave *slave; + struct slave *slave, *curr; =20 if (!bond_has_slaves(bond)) { atomic_set(&bond_info->tx_rebalance_counter, 0); @@ -1597,9 +1597,11 @@ void bond_alb_monitor(struct work_struct *work) * because a slave was disabled then * it can now leave promiscuous mode. */ - dev_set_promiscuity(rtnl_dereference(bond->curr_active_slave)->dev, - -1); - bond_info->primary_is_promisc =3D 0; + curr =3D rtnl_dereference(bond->curr_active_slave); + if (bond_info->primary_is_promisc && curr) { + dev_set_promiscuity(curr->dev, -1); + bond_info->primary_is_promisc =3D 0; + } =20 rtnl_unlock(); rcu_read_lock(); --=20 2.43.0