Re: [PATCH] IB/mlx4: Fix use-after-free on pkey sysfs registration failure
From: Leon Romanovsky
Date: Tue Sep 01 2026 - 11:04:53 EST
On Sun, 16 Aug 2026 00:45:10 -0400, Shuangpeng Bai wrote:
> 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.
>
> [...]
Applied, thanks!
[1/1] IB/mlx4: Fix use-after-free on pkey sysfs registration failure
https://git.kernel.org/rdma/rdma/c/1af874e9f4ce22
Best regards,
--
Leon Romanovsky <leon@xxxxxxxxxx>