mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 06:09:23 -04:00
soc: qcom: hgsl: Fix fence leak issue
sync_file_create increases refcount of fence, so need release dma fence handler after it. Change-Id: I3cc60d6a7e8a32138bfee611864cee00c2ac7dd3 Signed-off-by: Kasin Li <donglil@codeaurora.org>
This commit is contained in:
parent
bb168a0f46
commit
e424cb2f47
2 changed files with 6 additions and 4 deletions
|
|
@ -99,6 +99,7 @@ struct hgsl_isync_timeline {
|
|||
int id;
|
||||
struct hgsl_priv *priv;
|
||||
struct list_head fence_list;
|
||||
u64 context;
|
||||
spinlock_t lock;
|
||||
u32 last_ts;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ struct hgsl_hsync_fence *hgsl_hsync_fence_create(
|
|||
&timeline->lock, timeline->fence_context, ts);
|
||||
|
||||
fence->sync_file = sync_file_create(&fence->fence);
|
||||
dma_fence_put(&fence->fence);
|
||||
if (fence->sync_file == NULL) {
|
||||
hgsl_hsync_timeline_put(timeline);
|
||||
kfree(fence);
|
||||
|
|
@ -264,6 +265,7 @@ int hgsl_isync_timeline_create(struct hgsl_priv *priv,
|
|||
return -ENOMEM;
|
||||
|
||||
kref_init(&timeline->kref);
|
||||
timeline->context = dma_fence_context_alloc(1);
|
||||
INIT_LIST_HEAD(&timeline->fence_list);
|
||||
spin_lock_init(&timeline->lock);
|
||||
|
||||
|
|
@ -316,7 +318,7 @@ int hgsl_isync_fence_create(struct hgsl_priv *priv, uint32_t timeline_id,
|
|||
|
||||
dma_fence_init(&fence->fence, &hgsl_isync_fence_ops,
|
||||
&timeline->lock,
|
||||
dma_fence_context_alloc(1),
|
||||
timeline->context,
|
||||
ts);
|
||||
|
||||
sync_file = sync_file_create(&fence->fence);
|
||||
|
|
@ -326,6 +328,8 @@ int hgsl_isync_fence_create(struct hgsl_priv *priv, uint32_t timeline_id,
|
|||
goto out;
|
||||
}
|
||||
|
||||
dma_fence_put(&fence->fence);
|
||||
|
||||
*fence_fd = get_unused_fd_flags(0);
|
||||
if (*fence_fd < 0) {
|
||||
ret = -EBADF;
|
||||
|
|
@ -343,9 +347,6 @@ out:
|
|||
if (sync_file)
|
||||
fput(sync_file->file);
|
||||
|
||||
if (fence)
|
||||
dma_fence_put(&fence->fence);
|
||||
|
||||
if (timeline)
|
||||
hgsl_isync_timeline_put(timeline);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue