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 <[email protected]> Tested-by: Mikhail Gavrilov <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Bert Karwatzki <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent a3ee9e0 commit 9f8b370

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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)