Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

accel/amdxdna: Fix dma_fence leak when job is canceled

Currently, dma_fence_put(job->fence) is called in job notification
callback. However, if a job is canceled, the notification callback is never
invoked, leading to a memory leak. Move dma_fence_put(job->fence)
to the job cleanup function to ensure the fence is always released.

Fixes: aac243092b70 ("accel/amdxdna: Add command execution")
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20251105194140.1004314-1-lizhi.hou@amd.com

Lizhi Hou dea9f847 f23e40e3

+1 -1
-1
drivers/accel/amdxdna/aie2_ctx.c
··· 189 189 190 190 up(&job->hwctx->priv->job_sem); 191 191 job->job_done = true; 192 - dma_fence_put(fence); 193 192 mmput_async(job->mm); 194 193 aie2_job_put(job); 195 194 }
+1
drivers/accel/amdxdna/amdxdna_ctx.c
··· 422 422 trace_amdxdna_debug_point(job->hwctx->name, job->seq, "job release"); 423 423 amdxdna_arg_bos_put(job); 424 424 amdxdna_gem_put_obj(job->cmd_bo); 425 + dma_fence_put(job->fence); 425 426 } 426 427 427 428 int amdxdna_cmd_submit(struct amdxdna_client *client,