Or Har-Toov
2c6b640ea0
RDMA/mlx5: Fix unsafe xarray access in implicit ODP handling
__xa_store() and __xa_erase() were used without holding the proper lock,
which led to a lockdep warning due to unsafe RCU usage. This patch
replaces them with xa_store() and xa_erase(), which perform the necessary
locking internally.
=============================
WARNING: suspicious RCPU usage
6.14.0-rc7_for_upstream_debug_2025_03_18_15_01 #1 Not tainted
-----------------------------
./include/linux/xarray.h:1211 suspicious rcu_dereference_protected() usage!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
3 locks held by kworker/u136:0/219:
at: process_one_work+0xbe4/0x15f0
process_one_work+0x75c/0x15f0
pagefault_mr+0x9a5/0x1390 [mlx5_ib]
stack backtrace:
CPU: 14 UID: 0 PID: 219 Comm: kworker/u136:0 Not tainted
6.14.0-rc7_for_upstream_debug_2025_03_18_15_01 #1
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
Workqueue: mlx5_ib_page_fault mlx5_ib_eqe_pf_action [mlx5_ib]
Call Trace:
dump_stack_lvl+0xa8/0xc0
lockdep_rcu_suspicious+0x1e6/0x260
xas_create+0xb8a/0xee0
xas_store+0x73/0x14c0
__xa_store+0x13c/0x220
? xa_store_range+0x390/0x390
? spin_bug+0x1d0/0x1d0
pagefault_mr+0xcb5/0x1390 [mlx5_ib]
? _raw_spin_unlock+0x1f/0x30
mlx5_ib_eqe_pf_action+0x3be/0x2620 [mlx5_ib]
? lockdep_hardirqs_on_prepare+0x400/0x400
? mlx5_ib_invalidate_range+0xcb0/0xcb0 [mlx5_ib]
process_one_work+0x7db/0x15f0
? pwq_dec_nr_in_flight+0xda0/0xda0
? assign_work+0x168/0x240
worker_thread+0x57d/0xcd0
? rescuer_thread+0xc40/0xc40
kthread+0x3b3/0x800
? kthread_is_per_cpu+0xb0/0xb0
? lock_downgrade+0x680/0x680
? do_raw_spin_lock+0x12d/0x270
? spin_bug+0x1d0/0x1d0
? finish_task_switch.isra.0+0x284/0x9e0
? lockdep_hardirqs_on_prepare+0x284/0x400
? kthread_is_per_cpu+0xb0/0xb0
ret_from_fork+0x2d/0x70
? kthread_is_per_cpu+0xb0/0xb0
ret_from_fork_asm+0x11/0x20
Fixes: d3d930411c ("RDMA/mlx5: Fix implicit ODP use after free")
Link: https://patch.msgid.link/r/a85ddd16f45c8cb2bc0a188c2b0fcedfce975eb8.1750061791.git.leon@kernel.org
Signed-off-by: Or Har-Toov <ohartoov@nvidia.com>
Reviewed-by: Patrisious Haddad <phaddad@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
2025-06-17 14:13:10 -03:00
..
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-06 11:50:47 -07:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-05-15 16:25:20 -06:00
2025-06-08 09:07:37 +02:00
2025-05-30 09:15:40 -07:00
2025-06-03 11:53:55 -07:00
2025-06-08 09:07:37 +02:00
2025-05-24 08:29:32 +02:00
2025-06-08 09:07:37 +02:00
2025-05-30 20:21:36 +02:00
2025-06-08 09:07:37 +02:00
2025-05-23 13:26:24 -07:00
2025-05-12 23:50:49 -07:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-03 13:24:14 -07:00
2025-06-08 09:07:37 +02:00
2025-06-07 10:05:35 -07:00
2025-05-21 14:08:44 +02:00
2025-05-27 15:22:01 -07:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-03 08:39:20 -07:00
2025-06-08 09:07:37 +02:00
2025-05-22 18:04:43 +02:00
2025-06-08 09:07:37 +02:00
2025-05-24 22:49:07 +02:00
2025-05-27 16:48:47 -07:00
2025-06-08 09:07:37 +02:00
2025-06-17 14:13:10 -03:00
2025-06-08 09:07:37 +02:00
2025-05-19 17:09:50 +03:00
2025-06-08 09:07:37 +02:00
2025-06-05 08:49:30 -07:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-03 11:53:55 -07:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-06 11:50:47 -07:00
2025-05-31 15:44:16 -07:00
2025-05-19 15:37:53 +05:30
2025-06-08 09:07:37 +02:00
2025-06-08 11:33:00 -07:00
2025-06-08 09:07:37 +02:00
2025-05-28 14:55:35 -07:00
2025-06-05 08:20:21 -07:00
2025-05-30 09:46:28 -07:00
2025-06-08 09:07:37 +02:00
2025-05-19 16:11:05 +02:00
2025-05-31 19:12:53 -07:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-06 13:16:50 -07:00
2025-06-06 13:20:26 -07:00
2025-06-02 11:04:29 -07:00
2025-05-20 21:46:10 -05:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-05-16 21:06:11 +02:00
2025-05-31 07:53:30 -07:00
2025-06-05 08:07:24 -07:00
2025-06-06 13:22:31 -07:00
2025-05-21 14:53:17 +02:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-05-27 16:28:02 -07:00
2025-05-21 12:26:51 +02:00
2025-06-08 09:07:37 +02:00
2025-06-06 20:02:51 -07:00
2025-06-06 11:50:47 -07:00
2025-06-08 09:07:37 +02:00
2025-05-27 10:27:53 -04:00
2025-06-04 11:26:17 -07:00
2025-05-29 08:15:35 -07:00
2025-06-08 09:07:37 +02:00
2025-06-08 09:07:37 +02:00
2025-05-27 10:27:54 -04:00
2025-06-06 11:50:47 -07:00
2025-06-08 09:07:37 +02:00
2025-05-23 07:09:00 +02:00