summaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorAntoine Tenart <atenart@kernel.org>2021-06-24 11:38:28 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-14 16:56:28 +0200
commit711a28d24d0761e39820e2a6776ef8f12637ff3b (patch)
tree1788006c519643c84e4292c5bed1405114e5e3ce /include/net
parentc764f2d899b26eb2001358498eea5b1df031c18e (diff)
downloadlinux-stable-711a28d24d0761e39820e2a6776ef8f12637ff3b.tar.gz
linux-stable-711a28d24d0761e39820e2a6776ef8f12637ff3b.tar.bz2
linux-stable-711a28d24d0761e39820e2a6776ef8f12637ff3b.zip
net: macsec: fix the length used to copy the key for offloading
[ Upstream commit 1f7fe5121127e037b86592ba42ce36515ea0e3f7 ] The key length used when offloading macsec to Ethernet or PHY drivers was set to MACSEC_KEYID_LEN (16), which is an issue as: - This was never meant to be the key length. - The key length can be > 16. Fix this by using MACSEC_MAX_KEY_LEN to store the key (the max length accepted in uAPI) and secy->key_len to copy it. Fixes: 3cf3227a21d1 ("net: macsec: hardware offloading infrastructure") Reported-by: Lior Nahmanson <liorna@nvidia.com> Signed-off-by: Antoine Tenart <atenart@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/macsec.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/net/macsec.h b/include/net/macsec.h
index 52874cdfe226..d6fa6b97f6ef 100644
--- a/include/net/macsec.h
+++ b/include/net/macsec.h
@@ -241,7 +241,7 @@ struct macsec_context {
struct macsec_rx_sc *rx_sc;
struct {
unsigned char assoc_num;
- u8 key[MACSEC_KEYID_LEN];
+ u8 key[MACSEC_MAX_KEY_LEN];
union {
struct macsec_rx_sa *rx_sa;
struct macsec_tx_sa *tx_sa;