Re: [PATCH net-next v3 3/5] macsec: move netdev_upper_dev_link() after macsec_changelink_common()

From: Sabrina Dubroca

Date: Tue Mar 17 2026 - 08:04:20 EST


2026-03-16, 12:26:11 +0800, Hangbin Liu wrote:
> After calling netdev_change_features() in __netdev_upper_dev_link(),
> the call stack looks like:
>
> - netdev_upper_dev_link
> - __netdev_upper_dev_link
> - netdev_change_features
> - notifier_call_chain
> - rtnetlink_event
> - rtmsg_ifinfo_event
> - rtmsg_ifinfo_build_skb
>
> In macsec, we call netdev_upper_dev_link() before
> macsec_changelink_common(), which causes the fields of the MACsec
> Security Entity to be uninitialized. Later, macsec_fill_info() returns
> -EMSGSIZE and triggers WARN_ON() in rtmsg_ifinfo_build_skb.
>
> Fix this by moving netdev_upper_dev_link() after
> macsec_changelink_common(), and return 0 if secy->key_len is not
> initialized yet.
>
> Suggested-by: Sabrina Dubroca <sd@xxxxxxxxxxxxxxx>
> Signed-off-by: Hangbin Liu <liuhangbin@xxxxxxxxx>
> ---
> drivers/net/macsec.c | 23 ++++++++++++-----------
> 1 file changed, 12 insertions(+), 11 deletions(-)

I'm not sure I'll manage to look at the rest of the series before it's
applied, but for this patch:

Reviewed-by: Sabrina Dubroca <sd@xxxxxxxxxxxxxxx>

Thanks Hangbin.

--
Sabrina