]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
accel/amdxdna: Fix potential amdxdna_umap lifetime race
authorLizhi Hou <lizhi.hou@amd.com>
Mon, 6 Jul 2026 22:12:28 +0000 (15:12 -0700)
committerLizhi Hou <lizhi.hou@amd.com>
Tue, 7 Jul 2026 17:00:04 +0000 (10:00 -0700)
commit14f172eff9c19f8043a9858845f33cd034f3a41e
tree7cd1c46d5edd56dc5abdf6031b7bc75b9539734c
parentac7c6b4308c5e757eb278d47b9c0761c31ac9d6b
accel/amdxdna: Fix potential amdxdna_umap lifetime race

amdxdna_umap_release() calls the blocking mmu_interval_notifier_remove()
before removing the object from abo->mem.umap_list. If
aie2_populate_range() runs concurrently, it may obtain a reference to an
amdxdna_umap that is being released, leading to a potential use-after-free.

Use kref_get_unless_zero() in aie2_populate_range() when acquiring a
reference. If the reference count has already dropped to zero, release
is in progress and the entry is skipped.

Fixes: e486147c912f ("accel/amdxdna: Add BO import and export")
Reviewed-by: Max Zhen <max.zhen@amd.com>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20260706221228.434099-1-lizhi.hou@amd.com
drivers/accel/amdxdna/aie2_ctx.c