]> git.baikalelectronics.ru Git - kernel.git/commit
net: macsec: fix the length used to copy the key for offloading
authorAntoine Tenart <atenart@kernel.org>
Thu, 24 Jun 2021 09:38:28 +0000 (11:38 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 24 Jun 2021 19:41:12 +0000 (12:41 -0700)
commitb72a5a2fb0d8e3ae6355c8766bb49ddb9d5a8cda
tree499085a89fb5c4931d9c6bd2bb65da4711e6f0a4
parentca65733e6388b9c6cd6e4267b93290dc6de6ab05
net: macsec: fix the length used to copy the key for offloading

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: 98e38d6db896 ("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>
drivers/net/macsec.c
include/net/macsec.h