[PATCH net] net: macsec: Retrieve MACSec-XPN attributes before offloading

Carlos Fernandez posted 1 patch 3 years, 11 months ago
There is a newer version of this series
drivers/net/macsec.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
[PATCH net] net: macsec: Retrieve MACSec-XPN attributes before offloading
Posted by Carlos Fernandez 3 years, 11 months ago
From 149a8fbcf7a410ed6be0e660d5b83eb9f17decc6 Mon Sep 17 00:00:00 2001
From: Carlos Fernandez <carlos.fernandez@technica-engineering.de>
Date: Tue, 24 May 2022 12:29:52 +0200
Subject: [PATCH net] net: macsec: Retrieve MACSec-XPN attributes before
 offloading

When MACsec offloading is used with XPN, before mdo_add_rxsa
and mdo_add_txsa functions are called, the key salt is not
copied to the macsec context struct. Offloaded phys will need
this data when performing offloading.

Fix by copying salt and id to context struct before calling the
offloading functions.

Fixes: 48ef50fa866a ("macsec: Netlink support of XPN cipher suites")
Signed-off-by: Carlos Fernandez <carlos.fernandez@technica-engineering.de>
---
 drivers/net/macsec.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index 832f09ac075e..4f2bd3d722c3 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -1804,6 +1804,14 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info)

        rx_sa->sc = rx_sc;

+       if (secy->xpn) {
+               rx_sa->ssci = nla_get_ssci(tb_sa[MACSEC_SA_ATTR_SSCI]);
+               nla_memcpy(rx_sa->key.salt.bytes, tb_sa[MACSEC_SA_ATTR_SALT],
+                          MACSEC_SALT_LEN);
+       }
+
+       nla_memcpy(rx_sa->key.id, tb_sa[MACSEC_SA_ATTR_KEYID], MACSEC_KEYID_LEN);
+
        /* If h/w offloading is available, propagate to the device */
        if (macsec_is_offloaded(netdev_priv(dev))) {
                const struct macsec_ops *ops;
@@ -1826,13 +1834,6 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info)
                        goto cleanup;
        }

-       if (secy->xpn) {
-               rx_sa->ssci = nla_get_ssci(tb_sa[MACSEC_SA_ATTR_SSCI]);
-               nla_memcpy(rx_sa->key.salt.bytes, tb_sa[MACSEC_SA_ATTR_SALT],
-                          MACSEC_SALT_LEN);
-       }
-
-       nla_memcpy(rx_sa->key.id, tb_sa[MACSEC_SA_ATTR_KEYID], MACSEC_KEYID_LEN);
        rcu_assign_pointer(rx_sc->sa[assoc_num], rx_sa);
Re: [PATCH net] net: macsec: Retrieve MACSec-XPN attributes before offloading
Posted by Jakub Kicinski 3 years, 11 months ago
On Thu, 26 May 2022 12:28:00 +0000 Carlos Fernandez wrote:
> From: Carlos Fernandez <carlos.fernandez@technica-engineering.de>
> To: "David S. Miller" <davem@davemloft.net>, Eric Dumazet  <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni  <pabeni@redhat.com>, Era Mayflower <mayflowerera@gmail.com>,  "netdev@vger.kernel.org" <netdev@vger.kernel.org>,  "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
> CC: Carlos Fernandez <carlos.fernandez@technica-engineering.de>
> Subject: [PATCH net] net: macsec: Retrieve MACSec-XPN attributes before  offloading
> Date: Thu, 26 May 2022 12:28:00 +0000
> 
> From 149a8fbcf7a410ed6be0e660d5b83eb9f17decc6 Mon Sep 17 00:00:00 2001
> From: Carlos Fernandez <carlos.fernandez@technica-engineering.de>
> Date: Tue, 24 May 2022 12:29:52 +0200
> Subject: [PATCH net] net: macsec: Retrieve MACSec-XPN attributes before
>  offloading
> 
> When MACsec offloading is used with XPN, before mdo_add_rxsa
> and mdo_add_txsa functions are called, the key salt is not
> copied to the macsec context struct. Offloaded phys will need
> this data when performing offloading.

Now git can't detect the patch at all:

$ git pw series apply 645266
Patch is empty.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

:(