]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
accel/amdxdna: Fix use-after-free of mm_struct in job scheduler
authorLizhi Hou <lizhi.hou@amd.com>
Thu, 16 Jul 2026 15:13:05 +0000 (08:13 -0700)
committerLizhi Hou <lizhi.hou@amd.com>
Fri, 17 Jul 2026 03:05:28 +0000 (20:05 -0700)
commitfaebb7ba1ac65fa5810b640df02ce04e509fdc11
tree0874e13a6b5508bc949cd61070ea8d104850052b
parent266cddf7bd0f6c79b6c0633aef742a22bf70265b
accel/amdxdna: Fix use-after-free of mm_struct in job scheduler

amdxdna_cmd_submit() stores current->mm in job->mm without holding any
reference. aie2_sched_job_run() later access job->mm from the DRM
scheduler worker thread. With only a raw pointer and no structural
reference, the mm_struct can be freed before the scheduler runs the job.

Fix this by calling mmgrab() to hold a structural mm_count reference for
the lifetime of the job, paired with mmdrop() in every cleanup path.

Fixes: aac243092b70 ("accel/amdxdna: Add command execution")
Reviewed-by: Max Zhen <max.zhen@amd.com>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20260716151305.1595780-1-lizhi.hou@amd.com
drivers/accel/amdxdna/amdxdna_ctx.c