]> git.proxmox.com Git - mirror_ubuntu-hirsute-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)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 13 Aug 2021 07:31:00 +0000 (09:31 +0200)
commit15578591c6bb692cc6d59c7c42b6dd28076317da
tree3b874a2568783bda18430cbd45ff64ec9fd0a047
parent5494cab73cca291fd35ae5f4be43217d31a6b034
net: macsec: fix the length used to copy the key for offloading

BugLink: https://bugs.launchpad.net/bugs/1938340
[ 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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/macsec.c
include/net/macsec.h