Re: [PATCH net-next v4 1/1] bonding: keep non-Ethernet slaves out of 802.3ad bonds
From: Nikolay Aleksandrov
Date: Tue Nov 24 2026 - 03:42:18 EST
On 24/11/2026 07:13, Kyuwon Cho wrote:
bond_open() adds the 8-byte lacpdu_mcast_addr to every slave of an
802.3ad bond with dev_mc_add(), which copies the slave's addr_len bytes.
A slave with a 16-byte address, such as an ip6tnl device, makes it read
past the array:
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 at addr ffffffff878a2940 by task test/114
Call Trace:
<TASK>
__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)
__dev_open (net/core/dev.c:1762)
__dev_change_flags (net/core/dev.c:10022)
netif_change_flags (net/core/dev.c:10087)
do_setlink.isra.0 (net/core/rtnetlink.c:3294)
rtnl_setlink (net/core/rtnetlink.c:3633)
Commit c84fcb79e5db ("bonding: limit BOND_MODE_8023AD to Ethernet
devices") rejects such a slave only when enslaving it changes the
bond's type. A bond keeps the type of its last slave after that slave
is released, so a bond that once had an ARPHRD_TUNNEL6 slave can be set
to 802.3ad and take another TUNNEL6 device. A slave that is itself a
bond can also change its type after it was enslaved, when a
non-Ethernet device is enslaved to it.
Check that an 802.3ad slave is an Ethernet device before the type
handling, for every slave, and refuse NETDEV_PRE_TYPE_CHANGE for a
slave of an 802.3ad bond, as team does for its ports. Other modes still
allow the type change, as bond-eth-type-change.sh expects.
Fixes: c84fcb79e5db ("bonding: limit BOND_MODE_8023AD to Ethernet devices")
Suggested-by: Jay Vosburgh <jv@xxxxxxxxxxxxx>
Signed-off-by: Kyuwon Cho <kyuwoncho18@xxxxxxxxx>
---
LGTM,
Reviewed-by: Nikolay Aleksandrov <razor@xxxxxxxxxxxxx>