From: Antoine Tenart <atenart@kernel.org>
To: Carlos Fernandez <carlos.escuin@gmail.com>,
carlos.fernandez@technica-enineering.de, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
pabeni@redhat.com
Cc: Carlos Fernandez <carlos.fernandez@technica-engineering.de>
Subject: Re: [PATCH] net: macsec: XPN Salt copied before passing offload context
Date: Thu, 05 May 2022 15:28:05 +0200 [thread overview]
Message-ID: <165175728541.217313.17093503108252590709@kwain> (raw)
In-Reply-To: <20220505123803.17553-1-carlos.fernandez@technica-engineering.de>
Hello,
(Note: please use "[PATCH net]" for fixes and "[PATCH net-next]" for
improvements in the subject when submitting patches to the networking
subsystem).
Quoting Carlos Fernandez (2022-05-05 14:38:03)
> 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.
>
> Fix by copying salt to context struct before calling the
> offloading functions.
The commit message and title are referring to the XPN salt only, but
there is another XPN specific entry being moved by this commit. I would
suggest to update the commit title to:
"net: macsec: retrieve the XPN attributes before offloading"
> 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);
Is the key id part related to the XPN offloading not working?
Otherwise, it makes sense to copy all attributes before offloading the
operation but this should probably be in its own patch targeted at
net-next. (Same for the txsa part).
> /* 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);
>
> rtnl_unlock();
Thanks!
Antoine
next prev parent reply other threads:[~2022-05-05 13:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <[PATCH] net/macsec copy salt to MACSec ctx for XPN>
2022-05-05 12:38 ` Carlos Fernandez
2022-05-05 13:28 ` Antoine Tenart [this message]
2022-05-05 16:54 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=165175728541.217313.17093503108252590709@kwain \
--to=atenart@kernel.org \
--cc=carlos.escuin@gmail.com \
--cc=carlos.fernandez@technica-engineering.de \
--cc=carlos.fernandez@technica-enineering.de \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®