All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>
Cc: Saeed Mahameed <saeedm@nvidia.com>,
	netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
	Raed Salem <raeds@nvidia.com>
Subject: [V4 net 13/15] net/mlx5e: Fix macsec rx security association (SA) update/delete
Date: Wed, 26 Oct 2022 14:51:51 +0100	[thread overview]
Message-ID: <20221026135153.154807-14-saeed@kernel.org> (raw)
In-Reply-To: <20221026135153.154807-1-saeed@kernel.org>

From: Raed Salem <raeds@nvidia.com>

The cited commit adds the support for update/delete MACsec Rx SA,
naturally, these operations need to check if the SA in question exists
to update/delete the SA and return error code otherwise, however they
do just the opposite i.e. return with error if the SA exists

Fix by change the check to return error in case the SA in question does
not exist, adjust error message and code accordingly.

Fixes: aae3454e4d4c ("net/mlx5e: Add MACsec offload Rx command support")
Signed-off-by: Raed Salem <raeds@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 .../ethernet/mellanox/mlx5/core/en_accel/macsec.c    | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
index 250c878ba2c9..6ae9fcdbda07 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
@@ -999,11 +999,11 @@ static int mlx5e_macsec_upd_rxsa(struct macsec_context *ctx)
 	}
 
 	rx_sa = rx_sc->rx_sa[assoc_num];
-	if (rx_sa) {
+	if (!rx_sa) {
 		netdev_err(ctx->netdev,
-			   "MACsec offload rx_sc sci %lld rx_sa %d already exist\n",
+			   "MACsec offload rx_sc sci %lld rx_sa %d doesn't exist\n",
 			   sci, assoc_num);
-		err = -EEXIST;
+		err = -EINVAL;
 		goto out;
 	}
 
@@ -1055,11 +1055,11 @@ static int mlx5e_macsec_del_rxsa(struct macsec_context *ctx)
 	}
 
 	rx_sa = rx_sc->rx_sa[assoc_num];
-	if (rx_sa) {
+	if (!rx_sa) {
 		netdev_err(ctx->netdev,
-			   "MACsec offload rx_sc sci %lld rx_sa %d already exist\n",
+			   "MACsec offload rx_sc sci %lld rx_sa %d doesn't exist\n",
 			   sci, assoc_num);
-		err = -EEXIST;
+		err = -EINVAL;
 		goto out;
 	}
 
-- 
2.37.3


  parent reply	other threads:[~2022-10-26 13:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26 13:51 [pull request][V4 net 00/15] mlx5 fixes 2022-10-14 Saeed Mahameed
2022-10-26 13:51 ` [V4 net 01/15] net/mlx5e: Do not increment ESN when updating IPsec ESN state Saeed Mahameed
2022-10-27 18:20   ` patchwork-bot+netdevbpf
2022-10-26 13:51 ` [V4 net 02/15] net/mlx5: Wait for firmware to enable CRS before pci_restore_state Saeed Mahameed
2022-10-26 13:51 ` [V4 net 03/15] net/mlx5: DR, Fix matcher disconnect error flow Saeed Mahameed
2022-10-27 18:15   ` Jakub Kicinski
2022-10-26 13:51 ` [V4 net 04/15] net/mlx5e: Extend SKB room check to include PTP-SQ Saeed Mahameed
2022-10-26 13:51 ` [V4 net 05/15] net/mlx5e: Update restore chain id for slow path packets Saeed Mahameed
2022-10-26 13:51 ` [V4 net 06/15] net/mlx5: ASO, Create the ASO SQ with the correct timestamp format Saeed Mahameed
2022-10-26 13:51 ` [V4 net 07/15] net/mlx5: Fix possible use-after-free in async command interface Saeed Mahameed
2022-10-26 13:51 ` [V4 net 08/15] net/mlx5e: TC, Reject forwarding from internal port to internal port Saeed Mahameed
2022-10-26 13:51 ` [V4 net 09/15] net/mlx5e: TC, Fix cloned flow attr instance dests are not zeroed Saeed Mahameed
2022-10-26 13:51 ` [V4 net 10/15] net/mlx5: Update fw fatal reporter state on PCI handlers successful recover Saeed Mahameed
2022-10-26 13:51 ` [V4 net 11/15] net/mlx5: Fix crash during sync firmware reset Saeed Mahameed
2022-10-26 13:51 ` [V4 net 12/15] net/mlx5e: Fix macsec coverity issue at rx sa update Saeed Mahameed
2022-10-26 13:51 ` Saeed Mahameed [this message]
2022-10-26 13:51 ` [V4 net 14/15] net/mlx5e: Fix wrong bitwise comparison usage in macsec_fs_rx_add_rule function Saeed Mahameed
2022-10-26 13:51 ` [V4 net 15/15] net/mlx5e: Fix macsec sci endianness at rx sa update Saeed Mahameed

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=20221026135153.154807-14-saeed@kernel.org \
    --to=saeed@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=raeds@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.