* [PATCH] drm/ttm: fix dma_fence refcount imbalance on error path
@ 2019-04-10 2:23 Lin Yi
0 siblings, 0 replies; only message in thread
From: Lin Yi @ 2019-04-10 2:23 UTC (permalink / raw)
To: christian.koenig; +Cc: csong, liujian6, teroincn, zhiyunq, dri-devel, yiqiuping
the ttm_bo_add_move_fence takes a reference to the struct dma_fence, but
failed to release it on the error path, leading to a memory leak.
add dma_fence_put before return when error occur.
Signed-off-by: Lin Yi <teroincn@163.com>
---
drivers/gpu/drm/ttm/ttm_bo.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 988416f..41d07fa 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -876,8 +876,10 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo,
reservation_object_add_shared_fence(bo->resv, fence);
ret = reservation_object_reserve_shared(bo->resv, 1);
- if (unlikely(ret))
+ if (unlikely(ret)) {
+ dma_fence_put(fence);
return ret;
+ }
dma_fence_put(bo->moving);
bo->moving = fence;
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-04-10 2:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-10 2:23 [PATCH] drm/ttm: fix dma_fence refcount imbalance on error path Lin Yi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox