diff options
author | Sabrina Dubroca <sd@queasysnail.net> | 2022-11-02 22:33:16 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-11-04 10:43:56 +0000 |
commit | aaab73f8fba4fd38f4d2617440d541a1c334e819 (patch) | |
tree | 1056d292135103ec50d2fb60c614e4c4a2d450fa /drivers | |
parent | 80df4706357a5a06bbbc70273bf2611df1ceee04 (diff) | |
download | linux-rpi-aaab73f8fba4fd38f4d2617440d541a1c334e819.tar.gz linux-rpi-aaab73f8fba4fd38f4d2617440d541a1c334e819.tar.bz2 linux-rpi-aaab73f8fba4fd38f4d2617440d541a1c334e819.zip |
macsec: clear encryption keys from the stack after setting up offload
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/macsec.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index 700a8f96c6c2..85376d2f24ca 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c @@ -1839,6 +1839,7 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info) secy->key_len); err = macsec_offload(ops->mdo_add_rxsa, &ctx); + memzero_explicit(ctx.sa.key, secy->key_len); if (err) goto cleanup; } @@ -2081,6 +2082,7 @@ static int macsec_add_txsa(struct sk_buff *skb, struct genl_info *info) secy->key_len); err = macsec_offload(ops->mdo_add_txsa, &ctx); + memzero_explicit(ctx.sa.key, secy->key_len); if (err) goto cleanup; } |