]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
accel/amdxdna: Fix use-after-free in debug BO command handling
authorLizhi Hou <lizhi.hou@amd.com>
Wed, 1 Jul 2026 15:55:56 +0000 (08:55 -0700)
committerLizhi Hou <lizhi.hou@amd.com>
Wed, 1 Jul 2026 21:57:45 +0000 (14:57 -0700)
commitec3304ddfd99adf531244be3a35c77b52583d5d3
tree78b32794f087789874465c81ab7f61e6b6979051
parent613059875958e7b217b250ed14c3b189f9488421
accel/amdxdna: Fix use-after-free in debug BO command handling

When a debug BO command completes, job->drv_cmd may already have been
freed. Accessing it from aie2_sched_drvcmd_resp_handler() can result in
a use-after-free and memory corruption.

Fix this by introducing reference counting for drv_cmd objects and
transferring ownership to the job while it is in flight. This ensures
that the command remains valid until the completion handler finishes
processing it.

Fixes: 7ea046838021 ("accel/amdxdna: Support firmware debug buffer")
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20260701155556.663541-1-lizhi.hou@amd.com
drivers/accel/amdxdna/aie2_ctx.c
drivers/accel/amdxdna/amdxdna_ctx.h