summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>2025-11-24 15:33:41 +0100
committerAlex Deucher <alexander.deucher@amd.com>2025-11-26 11:25:29 -0500
commit723c1dd3629d2d6eb319247d4eaba9f7b78319fa (patch)
tree7ffd52b06479363dd21b13854e69409e1978ae22 /drivers/gpu/drm/amd/amdgpu
parent5de8ce0f3709ad93ca5a579aa45cf1b52d72bc90 (diff)
drm/amdgpu: clear job on failure in amdgpu_job_alloc(_with_ib)
If memory is freed we need to nullify the pointer or the caller might call kfree again (eg: amdgpu_cs_parser_fini calls kfree on all non-null job pointers). Fixes: db36632ea51e ("drm/amdgpu: clean up and unify hw fence handling") Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_job.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
index 7d8ef7ae10c2..0707d2c2326f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
@@ -224,6 +224,7 @@ err_fence:
kfree((*job)->hw_fence);
err_job:
kfree(*job);
+ *job = NULL;
return r;
}
@@ -246,6 +247,7 @@ int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev,
if (entity)
drm_sched_job_cleanup(&(*job)->base);
kfree(*job);
+ *job = NULL;
}
return r;