]> git.hungrycats.org Git - linux/commit
accel/amdxdna: Fix hardware context race in amdxdna_update_heap()
authorLizhi Hou <lizhi.hou@amd.com>
Tue, 7 Jul 2026 05:58:18 +0000 (22:58 -0700)
committerLizhi Hou <lizhi.hou@amd.com>
Tue, 7 Jul 2026 17:04:51 +0000 (10:04 -0700)
commit928caf71e566ddc5f303f15fb9c33f16a9915f30
treee64d01d3c7344f6be344537e19b393da4353794b
parentc8d2530791cb53602ac06ec2db6287d99f51cdbc
accel/amdxdna: Fix hardware context race in amdxdna_update_heap()

amdxdna_update_heap() iterates over hardware contexts while holding
xdna->dev_lock. During the iteration, amdxdna_pm_resume_get_locked() may
temporarily release and reacquire the lock, allowing hardware contexts to
be modified concurrently.

Fix the race by calling amdxdna_pm_resume_get_locked() before
iterating over hardware contexts.

Fixes: dbc8fd7a03cb ("accel/amdxdna: Add expandable device heap support")
Reviewed-by: Max Zhen <max.zhen@amd.com>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20260707055818.479165-1-lizhi.hou@amd.com
drivers/accel/amdxdna/aie2_ctx.c
drivers/accel/amdxdna/amdxdna_ctx.c