๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27140

Re: [PATCH net] macsec: reject lower device type changes

#27140
From: netdev-bot+sashiko
Date: Fri, 04 Dec 2026 21:36
90 lines
11171 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The Fixes: tag and the commit message point at the wrong
  origin and understate what the change does.

--

macsec: reject lower device type changes

This patch makes macsec_notify() return NOTIFY_BAD for
NETDEV_PRE_TYPE_CHANGE on a macsec lower device, which matches what
macvlan and ipvlan already do. It fixes a KASAN stack out-of-bounds read
in macsec_set_mac_address(). That read happens after the lower device
changes to a type with a longer address.

> Fixes: 25a00d0cd691 ("net: macsec: revert the MAC address if mdo_upd_secy fails")

[Severity: Medium]
Does this Fixes: tag point at the right commit?

The Ethernet-only rule for macsec lower devices comes from commit
b06d072ccc4b ("macsec: restrict to ethernet devices"). That commit added
this check to macsec_newlink():

	if (real_dev->type != ARPHRD_ETHER)
		return -EINVAL;

The check only runs when the macsec device is created. Before this patch,
nothing stopped the lower device from changing type afterwards. Bond,
team, tun (TUNSETLINK), qmi_wwan and hdlc all send
NETDEV_PRE_TYPE_CHANGE, and macsec_notify() did not veto it.

Commit 25a00d0cd691 only added the six-byte old_addr[ETH_ALEN] stack
buffer in macsec_set_mac_address(). The KASAN read shows up there, in
dev_uc_del(real_dev, old_addr). That is where the symptom appears, not
where the bug came from.

Stable trees older than v6.8 do not have 25a00d0cd691, but they still let
the lower device change type. With only this tag, would those trees miss
the fix?

On those kernels macsec_handle_frame() can again receive non-Ethernet
frames. That is the problem b06d072ccc4b was written to fix (a syzbot
KMSAN report with a phonet lower device).

Here is one way to hit it before this patch:

  1. Create a bond with no slaves, so its type is ARPHRD_ETHER.
  2. Add a macsec device on top of the bond.
  3. Enslave a non-Ethernet device to the bond.

bond_enslave() sends NETDEV_PRE_TYPE_CHANGE, macsec_notify() lets it
through, and the bond's type changes under the macsec device.

Would it make sense to use this tag instead:

Fixes: b06d072ccc4b ("macsec: restrict to ethernet devices")

25a00d0cd691 could stay as a second Fixes: tag.

The commit message only describes the MAC address path. Could it also
say that the patch makes the Ethernet-only rule hold for the whole
lifetime of the macsec device?

> diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
> index 240ba0ae07d1e..5dd6f18cd1860 100644
> --- a/drivers/net/macsec.c
> +++ b/drivers/net/macsec.c
> @@ -4508,6 +4508,8 @@ static int macsec_notify(struct notifier_block *this, unsigned long event,
>  	rxd = macsec_data_rtnl(real_dev);
>  
>  	switch (event) {
> +	case NETDEV_PRE_TYPE_CHANGE:
> +		return NOTIFY_BAD;
>  	case NETDEV_DOWN:
>  	case NETDEV_UP:
>  	case NETDEV_CHANGE:

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/179633073717.3973710.645966213375260560%40skku.edu
Technical Details
Message-ID: <179642018292.3146.12819606039816109021@kernel.org>
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377644-linux-kernel-netdev=dewy.ru
References: <179633073717.3973710.645966213375260560@skku.edu>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377644-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] macsec: reject lower device type changes
Date: Fri, 04 Dec 2026 21:36:22 +0000
Organization: Usenet Network
Message-ID: <179642018292.3146.12819606039816109021@kernel.org>
References: <179633073717.3973710.645966213375260560@skku.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2875070"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:xDAgORllBp8CC/+rCp2L0nVhRUA= sha256:ladPa0/jB1nZnxJiq2GvZANDpWHzDogR9dbl9kprrJ4=
	sha1:euGvNcmxdmSsMeyuM0zNyEWpxgc= sha256:Pc0hf/QxM693RpyKWYH2uw8nYqt6hfs+rXmuJt1rfAY=
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 DC6E1117CA8; Sat,  5 Dec 2026 00:36:44 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.541
X-Spam-Status: No, score=-3.541 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.142, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	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 (2048-bit key)
	header.d=kernel.org
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 AfmMeOvE91DX;
	Sat,  5 Dec 2026 00:36:37 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377644-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 1ACEA117CCC; Sat,  5 Dec 2026 00:36:28 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 1AC193A649; Fri,  4 Dec 2026 21:36:25 +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=1796420185;
	b=PAx3OEntRgdITEFgRpw2BrOmH4Mq7hjNrPXxmMg245OpcwVtrKlwg7AiILxmb4gU/t3m
	 yOKDldRQQ+QImnMv4oa7pJE0yrSTmySaR7RFEi7BZNKjy4zm933qvkfWzBStKpz1O2Ghw
	 hqg1WYBj44Rdj9ZWn8du0ZdLOkioxHx9ZzgUscFgORueD2mvJlKN+V+Z+Ll/xm5s3b429
	 Gp6tcUaugOsI8ht3Wmkk8pFNhLQ7M1MlxYELT+xoqcdTeLQJ0X61XgUIQWmnXGhaykAzd
	 H4euQI2j6TZoXKJsSMd4WOVyJVcFwnx5yroea8INnC61LeUAEIQxy3vJNZqB/UrU7aw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796420185;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=tHFfTN6/Az+JWlFncnrIxGUFPmydCd18EDewIR2WRm8=;
	b=yJCJ9eM4+UYggEbcJyNfUqLWplBKFDv7z1jTUPyhvb5NPd+MZc9Kkz2l/hfbagsgE912
	 D1BJHb3QvJy+aN34awY72WwKcn4svgMl6jXCU6nFBkdWp9WFLc3YkJ/tyXpjFc3hn5bPo
	 inr6krAFUshbeV21vkFj/CHGn0wYHgYUyfP7BTmwGQe4vkx47izHDTA7wBtFjQOJwR2i3
	 1FIhTvs/76TZtMgiprCTJShozsauwrXWZIV/ZW9WGftJh1S9XpyU0IbsLt1XzyMct3p1M
	 /U9TXmpp72gLLILJeG+7V6JxhUBx6pTrBWawLFbFizV2ffqj/ci3+MAr/E6BeZcme4A==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=odXNWc6M;
	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 E0DCF606A333;
	Fri,  4 Dec 2026 21:36:24 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=odXNWc6M
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796420184;
	b=u3Cyn+vFLm9NbbC6iYpG3hfbO1WrrVDULJDx0etwSeBv5J3CJvR1Y32sh3ZhHWuJac+N
	 pj9X1kQ2HrSj3nit8Japa6ABDHKwa6hKq70se9gi3hRguRHL+z/eh9DXGYTMcjPq4Jz+S
	 Me4Y2krM/tFKQJFnZ0e8XpvqI57ntTqvQ9a4zoEx2KCtB2nzgHtBjOmyveYD0UAhx4fpu
	 qGJeXjLJcVCjfQJrWoPbb1TsbSrfm0fmY0K2Nh5g+TT38mN5c078kdcGoCKaSo7jwePSk
	 l0kximrsbRoYgjMvXOgizuolIVDl8zMrfUkyyboZOubpeGUQIgTTxwVxjfhldJC/CGw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796420184;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=tHFfTN6/Az+JWlFncnrIxGUFPmydCd18EDewIR2WRm8=;
	b=uM7dwdkZxAoWZpyjn7NHuNKzAURkVkt99tgWEgsfISweC1i6DazvTXc9b9CEWXwI+4ZG
	 ho9IwdAbGDaPQY0a9krdk1x9v6hA3OjQxJHsV8WVleI3y9VGj1RKtltGP86kQyLQ76k0H
	 I0ydTNKNF/6b1Oizu7cf/sbDFle9P1LYyM/TQ8FgyemeXusJ8f5V3cp736zjQNaRTlCR8
	 0OaBYoK7AiXhmBv4JTig3k73tWvPwYH6jmizm16/AlUMwHZ6F/43VPBtlhqtfiqTrW49m
	 VKvmzbipASb/zcXmfWn3pBddmDttLPcD9XfXTsIqnDO+qbnDUhcBvQDJkInOUGIrSow==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=odXNWc6M;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C42E606A322
	for <netdev@vger.kernel.org>; Fri,  4 Dec 2026 21:36:23 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FA3B1F00A06;
	Fri,  4 Dec 2026 21:36:23 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796420183;
	bh=tHFfTN6/Az+JWlFncnrIxGUFPmydCd18EDewIR2WRm8=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=odXNWc6M/eqDQc+wCS2ea51QAsjvWSiJa/iGghUTHU3d9+XjJruB3m+dTQaYLkqcj
	 RsDoPjbWT19p2rr0qz3ssj05l/ZkF4iL4/fkyyFEWk0t+weTpgMfnc0OlMXgtDNAMH
	 vzQ8Kl+/EQo8HDVppukZUhyTMFDZ/pi/Qwt/fb5NXxbFzTkmb2c1jjbSpOz1G1CjLQ
	 BPxpB/k+s8L9UB+5Te9ZO45QnTWl+QHc8fZjFSmf6bAoQkiUfQDtVBCulaYptXq+d2
	 nHRiYjTxcMAa8JKWisYkrs1ZrxdC4shUqo52OzXAr7tb5mky1ORMLDZzcpezVWBcWK
	 KhBnRXmaqAVuA==
X-Cc: sd@queasysnail.net, andrew+netdev@lunn.ch, davem@davemloft.net,
 edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 radu-nicolae.pirea@oss.nxp.com, netdev@vger.kernel.org
X-In-Reply-To: <179633073717.3973710.645966213375260560@skku.edu>
X-sashiko-severity: Medium
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