Skip to content

Commit 9f8b370

Browse files
spasswolfalexdeucher
authored andcommitted
drm/amdgpu: fix memory leak in amdgpu_cs_sync_rings
amdgpu_sync_get_fence deletes the returned fence from the syncobj, so the refcount of fence needs to lowered to avoid a memory leak. Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2360 Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Tested-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Bert Karwatzki <spasswolf@web.de> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/3b590ba0f11d24b8c6c39c3d38250129c1116af4.camel@web.de
1 parent a3ee9e0 commit 9f8b370

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1220,10 +1220,13 @@ static int amdgpu_cs_sync_rings(struct amdgpu_cs_parser *p)
12201220
* next job actually sees the results from the previous one
12211221
* before we start executing on the same scheduler ring.
12221222
*/
1223-
if (!s_fence || s_fence->sched != sched)
1223+
if (!s_fence || s_fence->sched != sched) {
1224+
dma_fence_put(fence);
12241225
continue;
1226+
}
12251227

12261228
r = amdgpu_sync_fence(&p->gang_leader->explicit_sync, fence);
1229+
dma_fence_put(fence);
12271230
if (r)
12281231
return r;
12291232
}

0 commit comments

Comments
 (0)