Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: kyuwon.cho@skku.edu
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
Subject: Re: [PATCH net] macsec: reject lower device type changes
Date: Fri, 04 Dec 2026 21:36:22 +0000	[thread overview]
Message-ID: <179642018292.3146.12819606039816109021@kernel.org> (raw)
In-Reply-To: <179633073717.3973710.645966213375260560@skku.edu>

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

      reply	other threads:[~2026-12-04 21:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 21:08 [PATCH net] macsec: reject lower device type changes Kyuwon Cho
2026-12-04 21:36 ` netdev-bot+sashiko [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=179642018292.3146.12819606039816109021@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kyuwon.cho@skku.edu \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=radu-nicolae.pirea@oss.nxp.com \
    --cc=sd@queasysnail.net \
    /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