From: sashiko-bot@kernel.org
To: "Tariq Toukan" <tariqt@nvidia.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH net 01/10] net/mlx5e: Initialize IPsec XArrays with XA_FLAGS_LOCK_BH
Date: Fri, 27 Nov 2026 21:58:04 +0000 [thread overview]
Message-ID: <sashiko-outbox-238304@kernel.org> (raw)
In-Reply-To: <20261126215614.792598-2-tariqt@nvidia.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] net/mlx5e: use-after-free in mlx5e_ipsec_netevent_event()
[1]
--
commit 766bb77d37b4fbf59433c00ce0e158a9137f45fc
Author: Jianbo Liu <jianbol@nvidia.com>
net/mlx5e: Initialize IPsec XArrays with XA_FLAGS_LOCK_BH
This commit adds XA_FLAGS_LOCK_BH when initializing the ipsec->sadb and
ipsec->ipsec_obj_id_map XArrays to match their _bh accessor usage.
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> index fa6cb51fdb939..a549851c83827 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> @@ -1014,7 +1014,7 @@ void mlx5e_ipsec_init(struct mlx5e_priv *priv)
> if (!ipsec)
> return;
>
> - xa_init_flags(&ipsec->sadb, XA_FLAGS_ALLOC);
> + xa_init_flags(&ipsec->sadb, XA_FLAGS_ALLOC | XA_FLAGS_LOCK_BH);
> ipsec->mdev = priv->mdev;
> init_completion(&ipsec->comp);
> ipsec->wq = alloc_workqueue("mlx5e_ipsec: %s", WQ_UNBOUND, 0,
[Severity: Critical]
This problem wasn't introduced by this patch, but can
mlx5e_ipsec_netevent_event() hit a use-after-free on sa_entry while
iterating ipsec->sadb [1]?
xa_for_each_marked() only holds the RCU read lock during the XArray lookup,
leaving the loop body unprotected while mlx5e_xfrm_free_state() frees
sa_entry synchronously with kfree():
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c:mlx5e_ipsec_netevent_event() {
...
xa_for_each_marked(&ipsec->sadb, idx, sa_entry, MLX5E_IPSEC_TUNNEL_SA) {
attrs = &sa_entry->attrs;
...
queue_work(ipsec->wq, &sa_entry->work->work);
}
...
}
CPU0 CPU1
mlx5e_ipsec_netevent_event()
xa_for_each_marked(&ipsec->sadb, ...)
mlx5e_xfrm_free_state()
kfree(sa_entry)
attrs = &sa_entry->attrs;
...
queue_work(..., &sa_entry->work->work); <-- use-after-free
[1] https://sashiko.dev/#/bug/linux-e041e0a2-c15e-4144-a77f-97cf6554a9fa
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261126215614.792598-1-tariqt@nvidia.com?part=1
next prev parent reply other threads:[~2026-11-27 21:58 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 21:56 [PATCH net 00/10] net/mlx5e: Fix IPsec SA races and neighbour handling Tariq Toukan
2026-11-26 21:56 ` [PATCH net 01/10] net/mlx5e: Initialize IPsec XArrays with XA_FLAGS_LOCK_BH Tariq Toukan
2026-11-27 21:58 ` sashiko-bot [this message]
2026-11-27 22:32 ` netdev-bot+sashiko
2026-11-26 21:56 ` [PATCH net 02/10] net/mlx5e: Stop counting packets dropped by IPsec RX SA rules Tariq Toukan
2026-11-27 22:32 ` netdev-bot+sashiko
2026-11-30 6:57 ` Jianbo Liu
2026-11-26 21:56 ` [PATCH net 03/10] net/mlx5e: Fix IPsec SA modify/stats update race Tariq Toukan
2026-11-27 22:32 ` netdev-bot+sashiko
2026-11-30 7:14 ` Jianbo Liu
2026-11-26 21:56 ` [PATCH net 04/10] net/mlx5e: Drain pending hardware event work before freeing IPsec SA Tariq Toukan
2026-11-27 22:32 ` netdev-bot+sashiko
2026-11-26 21:56 ` [PATCH net 05/10] net/mlx5e: Drop IPsec tunnel traffic if the neigh cannot be created Tariq Toukan
2026-11-27 21:58 ` sashiko-bot
2026-11-27 22:32 ` netdev-bot+sashiko
2026-11-30 7:40 ` Jianbo Liu
2026-11-26 21:56 ` [PATCH net 06/10] net/mlx5e: Fix IPv6 neighbour fallback for IPsec tunnels Tariq Toukan
2026-11-26 21:56 ` [PATCH net 07/10] net/mlx5e: Copy back only replay_esn after an IPsec ESN update Tariq Toukan
2026-11-26 21:56 ` [PATCH net 08/10] net/mlx5e: Validate neighbour events before updating IPsec SAs Tariq Toukan
2026-11-27 22:32 ` netdev-bot+sashiko
2026-11-30 10:01 ` Jianbo Liu
2026-11-26 21:56 ` [PATCH net 09/10] net/mlx5e: Serialize IPsec netevent MAC snapshots Tariq Toukan
2026-11-26 21:56 ` [PATCH net 10/10] net/mlx5e: Create IPsec flow counters once per SA Tariq Toukan
2026-11-27 22:32 ` netdev-bot+sashiko
2026-11-27 21:58 ` [PATCH net 00/10] net/mlx5e: Fix IPsec SA races and neighbour handling sashiko-bot
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=sashiko-outbox-238304@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--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.