diff options
| author | Lizhi Hou <lizhi.hou@amd.com> | 2025-11-05 11:41:40 -0800 |
|---|---|---|
| committer | Lizhi Hou <lizhi.hou@amd.com> | 2025-11-06 09:23:42 -0800 |
| commit | dea9f84776b96a703f504631ebe9fea07bd2c181 (patch) | |
| tree | 20e3f3760da168f958b3de17d0fd82e77e487519 | |
| parent | f23e40e378a0858da26e8d5a6f09f82ecd95e247 (diff) | |
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
| -rw-r--r-- | drivers/accel/amdxdna/aie2_ctx.c | 1 | ||||
| -rw-r--r-- | drivers/accel/amdxdna/amdxdna_ctx.c | 1 |
2 files changed, 1 insertions, 1 deletions
diff --git a/drivers/accel/amdxdna/aie2_ctx.c b/drivers/accel/amdxdna/aie2_ctx.c index b78c47ed0d34..bdc90fe8a47e 100644 --- a/drivers/accel/amdxdna/aie2_ctx.c +++ b/drivers/accel/amdxdna/aie2_ctx.c @@ -189,7 +189,6 @@ aie2_sched_notify(struct amdxdna_sched_job *job) up(&job->hwctx->priv->job_sem); job->job_done = true; - dma_fence_put(fence); mmput_async(job->mm); aie2_job_put(job); } diff --git a/drivers/accel/amdxdna/amdxdna_ctx.c b/drivers/accel/amdxdna/amdxdna_ctx.c index 878cc955f56d..d17aef89a0ad 100644 --- a/drivers/accel/amdxdna/amdxdna_ctx.c +++ b/drivers/accel/amdxdna/amdxdna_ctx.c @@ -422,6 +422,7 @@ void amdxdna_sched_job_cleanup(struct amdxdna_sched_job *job) trace_amdxdna_debug_point(job->hwctx->name, job->seq, "job release"); amdxdna_arg_bos_put(job); amdxdna_gem_put_obj(job->cmd_bo); + dma_fence_put(job->fence); } int amdxdna_cmd_submit(struct amdxdna_client *client, |