From: Kyuwon Cho <kyuwoncho18@gmail.com>
To: netdev@vger.kernel.org
Cc: Jay Vosburgh <jv@jvosburgh.net>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Hangbin Liu <hangbin.liu@linux.dev>,
linux-kernel@vger.kernel.org
Subject: [PATCH net v3 2/2] bonding: don't let an 802.3ad slave change its type
Date: Sun, 22 Nov 2026 23:59:10 +0900 [thread overview]
Message-ID: <179535729502.2645501.271186140389290426@gmail.com> (raw)
In-Reply-To: <179535729502.2645501.5219010464870440@gmail.com>
A bond can be a slave of another bond. Enslaving a non-Ethernet device to
an empty inner bond changes the inner bond's type in bond_setup_by_slave()
after NETDEV_PRE_TYPE_CHANGE, and nothing refuses that while the inner
bond is a slave of an 802.3ad bond. The outer bond then adds the 8-byte
lacpdu_mcast_addr to a slave whose addr_len is 16, the same global
out-of-bounds read as when such a slave is enslaved directly:
BUG: KASAN: global-out-of-bounds in __hw_addr_add_ex (net/core/dev_addr_lists.c:102 net/core/dev_addr_lists.c:157)
Read of size 16
Call Trace:
__hw_addr_add_ex (net/core/dev_addr_lists.c:102 net/core/dev_addr_lists.c:157)
dev_mc_add (net/core/dev_addr_lists.c:1036 net/core/dev_addr_lists.c:1054)
bond_open (drivers/net/bonding/bond_main.c:4405)
Refuse NETDEV_PRE_TYPE_CHANGE for a slave of an 802.3ad bond, as team
does for its ports. Other modes still allow it, as
bond-eth-type-change.sh expects.
Fixes: c84fcb79e5db ("bonding: limit BOND_MODE_8023AD to Ethernet devices")
Signed-off-by: Kyuwon Cho <kyuwoncho18@gmail.com>
---
drivers/net/bonding/bond_main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index bcc12ef34d9a..1a926b8d28b0 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3981,6 +3981,10 @@ static int bond_slave_netdev_event(unsigned long event,
slave_dbg(bond_dev, slave_dev, "%s called\n", __func__);
switch (event) {
+ case NETDEV_PRE_TYPE_CHANGE:
+ if (BOND_MODE(bond) == BOND_MODE_8023AD)
+ return NOTIFY_BAD;
+ break;
case NETDEV_UNREGISTER:
if (bond_dev->type != ARPHRD_ETHER)
bond_release_and_destroy(bond_dev, slave_dev);
--
2.43.0
prev parent reply other threads:[~2026-11-22 14:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 14:59 [PATCH net v3 0/2] bonding: keep non-Ethernet slaves out of 802.3ad bonds Kyuwon Cho
2026-11-22 14:59 ` [PATCH net v3 1/2] bonding: reject a non-Ethernet 802.3ad slave even when the type matches Kyuwon Cho
2026-11-22 14:59 ` Kyuwon Cho [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179535729502.2645501.271186140389290426@gmail.com \
--to=kyuwoncho18@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hangbin.liu@linux.dev \
--cc=jv@jvosburgh.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®