mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 15:49:17 -04:00
msm: kgsl: Initialize fence only if it gets refcount on timeline
kgsl_timeline_get can return NULL incase timeline pointer is NULL or refcount on timeline already went to zero. Current code is not checking this and going ahead with fence initialization which could result in invalid pointer access. Fix this by ensuring fence got a reference count on timeline before proceeding with initialization. Change-Id: I14d1355b1ea45e854bef8acf4afef53e0f4ceefc Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
This commit is contained in:
parent
4dff56a429
commit
fcbe669554
1 changed files with 4 additions and 0 deletions
|
|
@ -299,6 +299,10 @@ struct dma_fence *kgsl_timeline_fence_alloc(struct kgsl_timeline *timeline,
|
|||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
fence->timeline = kgsl_timeline_get(timeline);
|
||||
if (!fence->timeline) {
|
||||
kfree(fence);
|
||||
return ERR_PTR(-ENOENT);
|
||||
}
|
||||
|
||||
dma_fence_init(&fence->base, &timeline_fence_ops,
|
||||
&timeline->lock, timeline->context, seqno);
|
||||
|
|
|
|||
Loading…
Reference in a new issue