mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Fix memory leak in amdgpu_fence_emit
@ 2019-10-21 18:09 Navid Emamdoost
  2019-10-22  6:54 ` Koenig, Christian
  0 siblings, 1 reply; 2+ messages in thread
From: Navid Emamdoost @ 2019-10-21 18:09 UTC (permalink / raw)
  Cc: emamd001, kjlu, smccaman, Navid Emamdoost, Alex Deucher,
	Christian König, David (ChunMing) Zhou, David Airlie,
	Daniel Vetter, Evan Quan, Hawking Zhang, Sam Ravnborg, Jack Xiao,
	amd-gfx, dri-devel, linux-kernel

In the impelementation of amdgpu_fence_emit() if dma_fence_wait() fails
and returns an errno, before returning the allocated memory for fence
should be released.

Fixes: 3d2aca8c8620 ("drm/amdgpu: fix old fence check in amdgpu_fence_emit")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index 23085b352cf2..2f59c9270a7e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -166,8 +166,10 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f,
 		if (old) {
 			r = dma_fence_wait(old, false);
 			dma_fence_put(old);
-			if (r)
+			if (r) {
+				dma_fence_put(fence);
 				return r;
+			}
 		}
 	}
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-22  6:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-21 18:09 [PATCH] drm/amdgpu: Fix memory leak in amdgpu_fence_emit Navid Emamdoost
2019-10-22  6:54 ` Koenig, Christian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®