macsec: clear encryption keys from the stack after setting up offload
authorSabrina Dubroca <sd@queasysnail.net>
Wed, 2 Nov 2022 21:33:16 +0000 (22:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Nov 2022 08:58:16 +0000 (09:58 +0100)
commitb89a0d8859aed7ea8972ec825665941d180255ec
treed9d9efd006c3b9622cb3d94b710e8e3661083162
parenteeba7f07a0cbd50ba00ef77f4d1b3acb84d5c172
macsec: clear encryption keys from the stack after setting up offload

[ Upstream commit aaab73f8fba4fd38f4d2617440d541a1c334e819 ]

macsec_add_rxsa and macsec_add_txsa copy the key to an on-stack
offloading context to pass it to the drivers, but leaves it there when
it's done. Clear it with memzero_explicit as soon as it's not needed
anymore.

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