Re: [PATCH net v2] macsec: initialize SecY before registering the netdevice
From: Sabrina Dubroca
Date: Mon Sep 21 2026 - 05:50:55 EST
2026-09-18, 15:01:29 -0400, Haseeb Malik via B4 Relay wrote:
> From: Haseeb Malik <haseebulhaq55@xxxxxxxxx>
>
> Creating a MACsec device with MAC offload over an LRO-capable lower
> device triggers a warning in rtmsg_ifinfo_build_skb() when IPv4
> forwarding is enabled by default.
>
> register_netdevice() invokes inetdev_init(), which disables LRO and emits
> a NETDEV_FEAT_CHANGE notification. This reaches macsec_fill_info() before
> macsec_add_dev() initializes the SecY. key_len is still zero, so
> macsec_fill_info() returns -EMSGSIZE and trips the WARN_ON in
> rtmsg_ifinfo_build_skb(), even though the skb has enough space.
>
> Initialize the SecY and apply the new-link attributes before registration.
> Move MAC address inheritance into macsec_newlink() so the SCI can also be
> initialized before registration-time notifications report it. Move the
> per-CPU statistics and metadata destination allocation into ndo_init(),
> and release partial allocations on failure.
>
> Fixes: ccfdec908922 ("macsec: Add support for GCM-AES-256 cipher suite")
Why this commit? The "register, then init SCI etc" order of operations
has existed since day 1. Without ccfdec908922 we don't hit the WARN_ON
in rtmsg_ifinfo_build_skb, but the bit fixed by "Registration can
notify listeners before returning." would still be bogus.
The patch itself looks ok. Thanks for picking this up, things got
crazy and I forgot about it.
--
Sabrina