Re: [PATCH net-next] macsec: check for duplicate SCIs before registering the device

From: Sabrina Dubroca

Date: Mon Oct 12 2026 - 05:00:52 EST


2026-10-11, 21:57:11 +0000, Haseeb Malik via B4 Relay wrote:
> From: Haseeb Malik <haseebulhaq55@xxxxxxxxx>
>
> macsec_newlink() registers and links the device before rejecting a
> duplicate SCI. Registration can emit link notifications for a device
> whose creation ultimately fails with -EBUSY.
>
> The SCI is already resolved before SecY initialization, so check for a
> duplicate there and return -EBUSY directly. Remove the now-unused unlink
> label while preserving cleanup for failures after registration.
>
> Suggested-by: Sabrina Dubroca <sd@xxxxxxxxxxxxxxx>
> Link: https://lore.kernel.org/netdev/ar2KmwhtCMbOKLsG@krikkit/
> Assisted-by: LLM
> Signed-off-by: Haseeb Malik <haseebulhaq55@xxxxxxxxx>
> ---
> Tested on arm64 in virtme with KASAN and lockdep: all 15 MACsec selftests
> and 80 offload/cleanup cycles pass. Rejected-device link notifications
> observed by the diagnostic drop from two to zero.

Thanks.

Reviewed-by: Sabrina Dubroca <sd@xxxxxxxxxxxxxxx>

Sashiko is probably going to complain again about the mdo_add_secy
cleanup problem it caught in
https://lore.kernel.org/all/178951752525.22033.8547704610100726932@xxxxxxxxxx/

If you have the time and interest to look at this, it would be
nice. If not, no worries, I'll take care of it later.

--
Sabrina