Skip to content

Commit aaab73f

Browse files
qsndavem330
authored andcommitted
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: 3cf3227 ("net: macsec: hardware offloading infrastructure") Signed-off-by: Sabrina Dubroca <[email protected]> Reviewed-by: Antoine Tenart <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 80df470 commit aaab73f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/macsec.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,6 +1839,7 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info)
18391839
secy->key_len);
18401840

18411841
err = macsec_offload(ops->mdo_add_rxsa, &ctx);
1842+
memzero_explicit(ctx.sa.key, secy->key_len);
18421843
if (err)
18431844
goto cleanup;
18441845
}
@@ -2081,6 +2082,7 @@ static int macsec_add_txsa(struct sk_buff *skb, struct genl_info *info)
20812082
secy->key_len);
20822083

20832084
err = macsec_offload(ops->mdo_add_txsa, &ctx);
2085+
memzero_explicit(ctx.sa.key, secy->key_len);
20842086
if (err)
20852087
goto cleanup;
20862088
}

0 commit comments

Comments
 (0)