From: Hangbin Liu <hangbin.liu@linux.dev>
To: Kyuwon Cho <kyuwoncho18@gmail.com>
Cc: netdev@vger.kernel.org, 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>,
linux-kernel@vger.kernel.org,
Nikolay Aleksandrov <razor@blackwall.org>
Subject: Re: [PATCH net v3 2/2] bonding: don't let an 802.3ad slave change its type
Date: Mon, 23 Nov 2026 11:25:37 +0800 [thread overview]
Message-ID: <20261123032537.GE10218@Liu-laptop> (raw)
In-Reply-To: <179535729502.2645501.271186140389290426@gmail.com>
On Sun, Nov 22, 2026 at 11:59:10PM +0900, Kyuwon Cho wrote:
> 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
>
Hmm, I personally prefer the approach used by vlan and team, which disallows
changing the slave type after enslavement. If you think we should only disable
the 802.3ad-specific part, this change should be merged with patch 1, as they
address the same issue.
Cc Nikolay since he add the bond-eth-type-change.sh test.
Thanks
Hangbin
next prev parent reply other threads:[~2026-11-23 3:25 UTC|newest]
Thread overview: 8+ 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-23 3:17 ` Hangbin Liu
2026-11-22 14:59 ` [PATCH net v3 2/2] bonding: don't let an 802.3ad slave change its type Kyuwon Cho
2026-11-23 3:25 ` Hangbin Liu [this message]
2026-11-23 4:29 ` Kyuwon Cho
2026-11-23 12:43 ` Nikolay Aleksandrov
2026-11-23 12:46 ` Nikolay Aleksandrov
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=20261123032537.GE10218@Liu-laptop \
--to=hangbin.liu@linux.dev \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=jv@jvosburgh.net \
--cc=kuba@kernel.org \
--cc=kyuwoncho18@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.