Commit b33b556c authored by Christian König's avatar Christian König

drm/syncobj: fix leaking dma_fence in drm_syncobj_query_ioctl

We need to check the context number instead if the previous sequence to detect
an error and if an error is detected we need to drop the reference to the
current fence or otherwise would leak it.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarLionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 27b575a9 ("drm/syncobj: add timeline payload query ioctl v6")
Link: https://patchwork.freedesktop.org/patch/319123/
parent 4de09ffc
...@@ -1298,14 +1298,14 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data, ...@@ -1298,14 +1298,14 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
struct dma_fence *iter, *last_signaled = NULL; struct dma_fence *iter, *last_signaled = NULL;
dma_fence_chain_for_each(iter, fence) { dma_fence_chain_for_each(iter, fence) {
if (!iter) if (iter->context != fence->context) {
break; dma_fence_put(iter);
dma_fence_put(last_signaled);
last_signaled = dma_fence_get(iter);
if (!to_dma_fence_chain(last_signaled)->prev_seqno)
/* It is most likely that timeline has /* It is most likely that timeline has
* unorder points. */ * unorder points. */
break; break;
}
dma_fence_put(last_signaled);
last_signaled = dma_fence_get(iter);
} }
point = dma_fence_is_signaled(last_signaled) ? point = dma_fence_is_signaled(last_signaled) ?
last_signaled->seqno : last_signaled->seqno :
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment