MA-13763 [#imx-1237] Fix fence signal memory leakage issue.
authorIvan.liu <xiaowen.liu@nxp.com>
Thu, 13 Dec 2018 03:15:21 +0000 (11:15 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Thu, 2 May 2019 08:35:28 +0000 (11:35 +0300)
The signal id is missed when set to fence.
Then signal structure will not be freed at last.
Set correct signal id to fence to fix this issue.

Change-Id: I6a67dac0f6979183796cb8e9f2ac7aef6623ac00
Signed-off-by: Ivan.liu <xiaowen.liu@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Shrikant Bobade <Shrikant_Bobade@mentor.com>
(cherry picked from commit 2ce8ab2b7de5c6eb2f20421909839a747ed85d06)

drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_sync.c

index c1367bc..1de57c5 100644 (file)
@@ -329,6 +329,7 @@ struct dma_fence * viv_fence_create(struct viv_sync_timeline *timeline,
 
     spin_lock_init(&fence->lock);
 
+    fence->signal = (gctSIGNAL)(uintptr_t)signal->id;
     fence->parent = timeline;
 
     seqno = (unsigned)atomic64_inc_return(&timeline->seqno);
@@ -366,6 +367,8 @@ struct dma_fence * viv_fence_create(struct viv_sync_timeline *timeline,
         fence->signal = NULL;
 
         dma_fence_signal_locked((struct dma_fence*)fence);
+        dma_fence_put((struct dma_fence*)fence);
+        fence = NULL;
     }
 
     return (struct dma_fence*)fence;