linux/drivers/infiniband/hw/mlx4
Shuangpeng Bai 1af874e9f4 IB/mlx4: Fix use-after-free on pkey sysfs registration failure
register_pkey_tree() ignores errors from register_one_pkey_tree() and
continues registering the remaining slaves. The per-slave error path has
already released the pkey parent kobjects, but their pointers remain
stored in the device. A later device cleanup therefore passes the stale
pointers to kobject_put(), causing a use-after-free.

Clear the parent pointers after releasing a failed slave tree and skip
unregistered trees during device cleanup. This preserves the existing
best-effort registration behavior while preventing a second cleanup of
the failed tree.

Fixes: c1e7e46612 ("IB/mlx4: Add iov directory in sysfs under the ib device")
Cc: stable@vger.kernel.org
Signed-off-by: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
Link: https://patch.msgid.link/20260816044510.3848996-1-shuangpeng.kernel@gmail.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2026-09-01 10:03:27 -04:00
..
ah.c RDMA: Restore ability to fail on AH destroy 2020-09-09 13:57:22 -03:00
alias_GUID.c RDMA/mlx4: Use secs_to_jiffies() instead of open-coding 2026-05-18 04:58:41 -04:00
cm.c IB/mlx4: Fix stale CM id_map entries when RTU is never received 2026-07-20 09:00:40 -04:00
cq.c RDMA/mlx4: Use ib_umem_get_cq_buf() for user CQ buffer 2026-05-29 20:19:59 -03:00
doorbell.c RDMA/umem: Rename ib_umem_get() to ib_umem_get_va() 2026-05-29 20:19:57 -03:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
mad.c Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
main.c RDMA: Remove redundant memset() from query_device callbacks 2026-07-14 02:53:14 -04:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
mcg.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
mlx4_ib.h IB/mlx4: Fill in the access_flags if IB_MR_REREG_ACCESS is not specified 2026-06-09 14:57:36 -03:00
mr.c RDMA/mlx4: use kzalloc() for the fast registration page list 2026-07-20 09:45:43 -04:00
qp.c RDMA/umem: Rename ib_umem_get() to ib_umem_get_va() 2026-05-29 20:19:57 -03:00
srq.c RDMA/umem: Rename ib_umem_get() to ib_umem_get_va() 2026-05-29 20:19:57 -03:00
sysfs.c IB/mlx4: Fix use-after-free on pkey sysfs registration failure 2026-09-01 10:03:27 -04:00