drm/syncobj: fix leaking dma_fence in drm_syncobj_query_ioctl
Subsystems (2)
PATCH 1/1 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.
--- drivers/gpu/drm/drm_syncobj.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_syncobj.c +5 -5
@@ -1298,14 +1298,14 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,struct dma_fence *iter, *last_signaled =NULL ;dma_fence_chain_for_each (iter, fence) { -if (!iter) -break ; -dma_fence_put (last_signaled); - last_signaled =dma_fence_get (iter); -if (!to_dma_fence_chain (last_signaled)->prev_seqno) +if (iter->context != fence->context) { +dma_fence_put (iter);/* It is most likely that timeline has * unorder points. */ break ; + } +dma_fence_put (last_signaled); + last_signaled =dma_fence_get (iter); } point =dma_fence_is_signaled (last_signaled) ? last_signaled->seqno :
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 5 lines · Christian König
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 Christian König <[email protected]>
Quoted 18 lines
--- drivers/gpu/drm/drm_syncobj.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/gpu/drm/drm_syncobj.c +1
-5@@ -1298,14 +1298,14 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,struct dma_fence *iter, *last_signaled =NULL ;dma_fence_chain_for_each (iter, fence) { -if (!iter) -break ; -dma_fence_put (last_signaled); - last_signaled =dma_fence_get (iter); -if (!to_dma_fence_chain (last_signaled)->prev_seqno) +if (iter->context != fence->context) {
drivers/gpu/drm/drm_syncobj.c int drm_syncobj_query_ioctl(struct drm_device *dev, void *data, · line 1311
Quoted 10 lines
drivers/gpu/drm/drm_syncobj.c +4
-0+dma_fence_put (iter);/* It is most likely that timeline has * unorder points. */ break ; + } +dma_fence_put (last_signaled); + last_signaled =dma_fence_get (iter); } point =dma_fence_is_signaled (last_signaled) ? last_signaled->seqno :
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Am 22.07.19 um 15:16 schrieb Lionel Landwerlin:
Quoted 9 lines · Christian König
Quoted 5 lines
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 Christian König <[email protected]>Fixes 27b575a9aa2f ("drm/syncobj: add timeline payload query ioctl v6")Reviewed-by Lionel Landwerlin <[email protected]>
CC stable? I'm not sure when this got upstream.
Christian.
Quoted 21 lines
Quoted 21 lines
---
drivers/gpu/drm/drm_syncobj.c| 10 +++++-----1 file changed, 5 insertions(+), 5 deletions(-)drivers/gpu/drm/drm_syncobj.c +2
-5@@ -1298,14 +1298,14 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data, struct dma_fence *iter, *last_signaled = NULL; dma_fence_chain_for_each(iter, fence) { - if (!iter) - break; - dma_fence_put(last_signaled); - last_signaled = dma_fence_get(iter); - if (!to_dma_fence_chain(last_signaled)->prev_seqno) + if (iter->context != fence->context) { + dma_fence_put(iter); /* It is most likely that timeline has
Quoted 10 lines
Quoted 8 lines
drivers/gpu/drm/drm_syncobj.c +3
-0* unorder points. */ break; + } + dma_fence_put(last_signaled); + last_signaled = dma_fence_get(iter); }point =
dma_fence_is_signaled(last_signaled)?last_signaled->seqno:
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): a4c1c291-bff1-d7cb-f510-fdea63e1eb9b-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 6 lines · Christian König
Am 22.07.19 um 15:16 schrieb Lionel Landwerlin:
Quoted 5 lines · Christian König
Quoted 4 lines
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.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Christian König <[email protected]>Fixes 27b575a9aa2f ("drm/syncobj: add timeline payload query ioctl v6")Reviewed-by Lionel Landwerlin <[email protected]>CC stable? I'm not sure when this got upstream.
Christian.
I thought it would get picked up automatically for the relevant stable version (and none if it's not upstream yet).
We also have to be nice to people cherry picking stuff like ChromeOS.
-Lionel
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
---
drivers/gpu/drm/drm_syncobj.c| 10 +++++-----1 file changed, 5 insertions(+), 5 deletions(-)drivers/gpu/drm/drm_syncobj.c +2
-5@@ -1298,14 +1298,14 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data, struct dma_fence *iter, *last_signaled = NULL; dma_fence_chain_for_each(iter, fence) { - if (!iter) - break; - dma_fence_put(last_signaled); - last_signaled = dma_fence_get(iter); - if (!to_dma_fence_chain(last_signaled)->prev_seqno) + if (iter->context != fence->context) { + dma_fence_put(iter); /* It is most likely that timeline has * unorder points. */ break;
Quoted 10 lines
Quoted 8 lines
Quoted 6 lines
drivers/gpu/drm/drm_syncobj.c +3
-0+ } + dma_fence_put(last_signaled); + last_signaled = dma_fence_get(iter); }point =
dma_fence_is_signaled(last_signaled)?last_signaled->seqno:
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx