Re: [PATCH net v2] net/mlx5e: IPOIB, Fix QPN lookup race

From: Tariq Toukan

Date: Thu Nov 05 2026 - 13:51:50 EST




On 01/11/2026 0:57, Prathamesh Deshpande wrote:
The parent RX completion path can load a QPN hash entry before
mlx5i_pkey_del_qpn() unlinks and frees it, then dereference freed memory.

Use RCU hlist operations and defer freeing with kfree_rcu(). The existing
RCU read-side section in mlx5e_napi_poll() covers the lookup. Keep ht_lock
for writers and acquire it before looking up the entry to delete.

Fixes: 7e7f4780c340 ("net/mlx5e: IPoIB, Use hash-table to map between QPN to child netdev")
Signed-off-by: Prathamesh Deshpande <prathameshdeshpande7@xxxxxxxxx>
---

Changes in v2:
- Replace the RX spinlock with RCU traversal and deferred freeing.
- Narrow the description to the parent CQE lookup race.

v1: https://lore.kernel.org/all/20261030002241.8508-1-prathameshdeshpande7@xxxxxxxxx/
Review: https://lore.kernel.org/all/ade46454-e575-43e4-85aa-eeb5ad79408a@xxxxxxxxxx/


nit: Convention is IPoIB, not IPOIB. Maybe can be modified while applying.

Reviewed-by: Tariq Toukan <tariqt@xxxxxxxxxx>

Thanks.