Article View: linux.kernel.netdev
Article #20682Re: [PATCH net v3 2/2] bonding: don't let an 802.3ad slave change its type
From: Hangbin Liu
Date: Mon, 23 Nov 2026 03:25
Date: Mon, 23 Nov 2026 03:25
54 lines
10602 bytes
10602 bytes
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
Technical Details
Message-ID:
<20261123032537.GE10218@Liu-laptop>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368989-linux-kernel-netdev=dewy.ruReferences:
<179535729502.2645501.5219010464870440@gmail.com> <179535729502.2645501.271186140389290426@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368989-linux-kernel-netdev=dewy.ru From: hangbin.liu@linux.dev (Hangbin Liu) Newsgroups: linux.kernel.netdev 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 Organization: Usenet Network Message-ID: <20261123032537.GE10218@Liu-laptop> References: <179535729502.2645501.5219010464870440@gmail.com> <179535729502.2645501.271186140389290426@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="3781087"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:oY2fbDcEPCEUTP2zKlF7fBTXce0= sha256:VYpIL8+Y9SFw7OOYx5Fm1ls2NqZ5KAk0lsxb4K/e5V0= sha1:pX035tiwd0Fi8cBX4f2lbUNmFQA= sha256:v26DGDkL6au26pGhrD3TTal0cu3RmoWSPAYzTfi4FwI= Content-Disposition: inline List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 6EF23125D83; Mon, 23 Nov 2026 06:26:07 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=linux.dev X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GeVmfgMBYbpT; Mon, 23 Nov 2026 06:26:03 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-368989-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 24202125D89; Mon, 23 Nov 2026 06:25:53 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 5BA4425232; Mon, 23 Nov 2026 03:25:52 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795404349; b=DaOWec9qmcHZUrYPn3MV3+0eHvQlS0oKmzp8+WIzM20D0rgGjLDxzBkCTzyPrF7W6Bzf hia1qc5SvvlppcDfA4MLw212Umcc3oGCHR0dd79Qu1gSlWEtz8W2hD3/UBKFaoSIUV16O Ed05JXNw5lE7We9UiZHHnKpzLcd2mUQvW66FDggwlGT1T3I+j5bYNj31uJUsPCxEBbkQv 1PYvPELofzV1OwK6fwbFNKzSw/AWkc8IflEcBjTNBH8id+uTaj7IKYWmygyQoCMCIET9N liPRs3grsT97gFo3nN9cOHI6LtsGutzSNVhXy6ojSKo99cPcWSUxVk0C44fcPW+jSNQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795404349; h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature: X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc: Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=e3Yc6JAlwaTv2qXHFm4ZyG1PlJXC648rlgLKH7Ra6f4=; b=ZOy7Z36J/sYNVZEnd2spqLyM5+aCRWyMmbNaF9El4xKGWMxUm88HopQfCkoWRBekcnBB jpaIY+UEVtHvD/rKIvwTyc8PFJH6Yw6ZVse63Wp36JJM1rbcPm7PUfU5opkE8hRvpJ4c4 AOvOEtF40mVkjMulB5dJbMgW//65Ryorr6bTmBM4P9f3rrJ5timDqRa2v+h0xMa8g8LyP zLxYXhQfmtTO0pC6tEpUZOOKXEBxdtdETLdrdt8IL5VzAud3yUzSBMCknFVZyqQMvF196 keSjGQXWzg4Tdx7yuBh7N4NeJj+CYnBLmPZtvFR+IMZxvHuykVzzjsExwkh/OaoZmxQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=LbRCt7No; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 63AC7606A335; Mon, 23 Nov 2026 03:25:49 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=LbRCt7No X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.40 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795404348; b=w2smoESy1pV5sNmCBz20DT4JXo5jblH6acgs2jnnRwo6A93EIh7A+cQc6sa6gGixduSG AmISu8iOMIDK/5y2zxH+roTCBwv7E03yfjTvec3K7jM4WZfmpx1Pa+WUoiVhSRw1OKOEx A+3E/wOsqx9GLox6gBQFRyep6fJx8F8YyaSTiIrvbD6rdOjSYf2orgGHQRs2mKG2j2tAC XEjXqF8OY3pEp3P/Pf/vH4UJF1PM1iIyrldkOMO19UrF6khCb8E5kOmJDjZIA4lf/QoBI Bb/MvQ0HoW//YLo8tRtkgSpnqhga1nnCLISz5X6Z2FK07JGVgtQWweCd+Uv8Bj5DztQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795404348; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=e3Yc6JAlwaTv2qXHFm4ZyG1PlJXC648rlgLKH7Ra6f4=; b=4YbUTZ91jP9jEIgJzfjeka0VjoXT/pQJC/RVEDPEXXDepgEFLeyEzx6bMsknW8+Y9/zZ d3PSjeyCBZGtdna39Bo5AgZ766Fd0+aFc3pumdCvHjLXzNZSVjC0WJ+yNFsiVlA/wtMnp /WqrOjQO5g5id6wQBmbvlSaUfHSxnYKTY3z730VOy8M4fpUejG3sZFgLlLti16JZ9JCzA MwsBtOx8ltMKgJQlDt6mf0pwWWPnvWu0WHZWkw5cOnZ28btCbYsC7vrXtWURjkodT2GGC LE/wjuvCQXNp3J8CWw0Tw8X6W8L6y7o00IpmLjIOW/ZT4XW/RGuueLmcMIeFx2tXQTw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=LbRCt7No; arc=none smtp.remote-ip=95.215.58.40 X-Received: from mta1.migadu.com (out-40.mta1.migadu.com [95.215.58.40]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1325606A31E for <netdev@vger.kernel.org>; Mon, 23 Nov 2026 03:25:47 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E1325606A31E X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: netdev@vger.kernel.org X-DKIM-Signature: a=rsa-sha256; bh=J0WzD7xt978YmwyUOKWILnt4R9Sg7QENfh2/qnfkRQY=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1795404345; v=1; x=1796009145; b=LbRCt7NoOPix3FxjACX2+/qFdievgMjaPgNzbac7c4baB1s1S3uFC0kB7CdJlUVDsJPH7bHX Mhb0RHImcXsvBxeZdiHfRLHhzLHrBLRN+gw4XJfPrQpQnf/7PlKbuoFVZ/Wm+5gf7O+syUqoaTM MAijQNZfoVPX4Sz+CdKdUnvE= X-Envelope-To: netdev@vger.kernel.org X-Received: by mta10.migadu.com with ESMTPS id f2f39b979a91e5d5; Mon, 23 Nov 2026 03:25:45 +0000 X-Mizu-Trace-ID: f2f39b979a91e5d5 X-Migadu-Flow: FLOW_OUT X-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> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <179535729502.2645501.271186140389290426@gmail.com>