mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tariq Toukan <tariqt@nvidia.com>
To: Changyul Lee <lcy8047@gmail.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Leon Romanovsky <leon@kernel.org>,
	Tariq Toukan <tariqt@nvidia.com>, Mark Bloch <mbloch@nvidia.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Sabrina Dubroca <sd@queasysnail.net>,
	Simon Horman <horms@kernel.org>,
	Joas Antonio dos Santos <joasantonio108@gmail.com>,
	Patrisious Haddad <phaddad@nvidia.com>,
	netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net/mlx5: macsec: Don't remove fs_id when adding a rule fails
Date: Mon, 9 Nov 2026 09:28:41 +0200	[thread overview]
Message-ID: <20c04fd0-fd61-4934-b54a-81e3f9d64f7d@nvidia.com> (raw)
In-Reply-To: <20261105003419.4016283-1-lcy8047@gmail.com>



On 05/11/2026 2:34, Changyul Lee wrote:
> macsec_fs_tx_add_rule() and macsec_fs_rx_add_rule() clean up a failed
> rule with macsec_fs_{tx,rx}_del_rule(), which also calls
> macsec_fs_id_del(). The fs_id is never in the xarray at that point:
> macsec_fs_id_add() is the last step of adding a rule and removes its
> own entry when it fails.
> 
> macsec_fs_id_del() then dereferences NULL, through macsec_device for
> the first SA of a MACsec netdev and through fs_id_found otherwise. On
> RX, the SAs of one SC share an fs_id, so a failure while adding another
> SA drops the reference that an existing SA holds.
> 
> Split the rule teardown from the fs_id removal and do only the teardown
> on the error paths.
> 
> Fixes: d4ece08f4b1d ("net/mlx5: Maintain fs_id xarray per MACsec device inside macsec steering")
> Signed-off-by: Changyul Lee <lcy8047@gmail.com>
> ---
> Found with a static analysis tool we are developing.
> 
> Compile-tested only (x86_64, W=1, CONFIG_MLX5_MACSEC=y). I do not have
> MACsec-capable ConnectX hardware and QEMU does not emulate it, so the
> failure was not reproduced.
> 
>   .../mellanox/mlx5/core/lib/macsec_fs.c        | 38 ++++++++++++-------
>   1 file changed, 24 insertions(+), 14 deletions(-)
> 
Thanks for your patch.

Reviewed-by: Tariq Toukan <tariqt@nvidia.com>

      reply	other threads:[~2026-11-09  7:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05  0:34 Changyul Lee
2026-11-09  7:28 ` Tariq Toukan [this message]

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=20c04fd0-fd61-4934-b54a-81e3f9d64f7d@nvidia.com \
    --to=tariqt@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=joasantonio108@gmail.com \
    --cc=kuba@kernel.org \
    --cc=lcy8047@gmail.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=phaddad@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=sd@queasysnail.net \
    /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®