macsec: delete new rxsc when offload fails
authorSabrina Dubroca <sd@queasysnail.net>
Wed, 2 Nov 2022 21:33:13 +0000 (22:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Nov 2022 08:58:16 +0000 (09:58 +0100)
commite957555a36946552c7cb79fbd27aefec179d189a
tree40347512f3adbde234ea25c15beee1bbbcd2b289
parentad25a115f50800c6847e0d841c5c7992a9f7c1b3
macsec: delete new rxsc when offload fails

[ Upstream commit 93a30947821c203d08865c4e17ea181c9668ce52 ]

Currently we get an inconsistent state:
 - netlink returns the error to userspace
 - the RXSC is installed but not offloaded

Then the device could get confused when we try to add an RXSA, because
the RXSC isn't supposed to exist.

Fixes: 3cf3227a21d1 ("net: macsec: hardware offloading infrastructure")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Reviewed-by: Antoine Tenart <atenart@kernel.org>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/macsec.c