Re: [PATCH net v3] macsec: initialize SecY before registering the netdevice

From: Sabrina Dubroca

Date: Thu Sep 24 2026 - 06:57:42 EST


2026-09-21, 16:40:30 -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.
>
> Even without the warning, notifications during registration can report
> uninitialized SecY attributes, including the SCI. This ordering has existed
> since the driver was introduced.
>
> 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: c09440f7dcb3 ("macsec: introduce IEEE 802.1AE driver")
> Reported-by: syzbot+f2f6312ad1b5a0bfe316@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes: https://syzkaller.appspot.com/bug?extid=f2f6312ad1b5a0bfe316
> Suggested-by: Sabrina Dubroca <sd@xxxxxxxxxxxxxxx>
> Link: https://lists.openwall.net/linux-kernel/2026/08/19/552
> Signed-off-by: Haseeb Malik <haseebulhaq55@xxxxxxxxx>

Reviewed-by: Sabrina Dubroca <sd@xxxxxxxxxxxxxxx>

Thanks for taking care of this.

--
Sabrina