All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/syncobj: Fix fence and syncobj leak on dma_fence_chain_alloc failure
@ 2026-11-06  9:57 tongzhiwei
  2026-11-06 10:10 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: tongzhiwei @ 2026-11-06  9:57 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Simona Vetter, David Airlie
  Cc: tongzhiwei, dri-devel, linux-kernel

NOTE: this commit is worked by llm completely

In drm_syncobj_import_sync_file_fence(), when point is non-zero and
dma_fence_chain_alloc() returns NULL, the function returns -ENOMEM
without releasing the fence reference (obtained via sync_file_get_fence)
or the syncobj reference (obtained via drm_syncobj_find).  Both
references are permanently leaked.

Add dma_fence_put(fence) and drm_syncobj_put(syncobj) before returning
-ENOMEM on the allocation failure path.

Assisted-by: LLM
Signed-off-by: tongzhiwei <tongzhiwei@cmss.chinamobile.com>
---
 drivers/gpu/drm/drm_syncobj.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index f1d4da168545..1825055e9b54 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -743,8 +743,11 @@ static int drm_syncobj_import_sync_file_fence(struct drm_file *file_private,
 	if (point) {
 		struct dma_fence_chain *chain = dma_fence_chain_alloc();
 
-		if (!chain)
+		if (!chain) {
+			dma_fence_put(fence);
+			drm_syncobj_put(syncobj);
 			return -ENOMEM;
+		}
 
 		drm_syncobj_add_point(syncobj, chain, fence, point);
 	} else {
-- 
2.43.0




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/syncobj: Fix fence and syncobj leak on dma_fence_chain_alloc failure
  2026-11-06  9:57 [PATCH] drm/syncobj: Fix fence and syncobj leak on dma_fence_chain_alloc failure tongzhiwei
@ 2026-11-06 10:10 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-06 10:10 UTC (permalink / raw)
  To: tongzhiwei; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/syncobj: missing Fixes trailer for
  drm_syncobj_import_sync_file_fence()
--

commit de478817c7c05dbb269859f891ebb406ae0d952f
Author: tongzhiwei <tongzhiwei@cmss.chinamobile.com>

> drm/syncobj: Fix fence and syncobj leak on dma_fence_chain_alloc failure
>
> NOTE: this commit is worked by llm completely
>
> In drm_syncobj_import_sync_file_fence(), when point is non-zero and
> dma_fence_chain_alloc() returns NULL, the function returns -ENOMEM
> without releasing the fence reference (obtained via sync_file_get_fence)
> or the syncobj reference (obtained via drm_syncobj_find).  Both
> references are permanently leaked.
>
> Add dma_fence_put(fence) and drm_syncobj_put(syncobj) before returning
> -ENOMEM on the allocation failure path.
>
> Assisted-by: LLM
> Signed-off-by: tongzhiwei <tongzhiwei@cmss.chinamobile.com>

[Severity: Low]
This fixes a reference leak introduced with timeline sync_file import
support.  Should the commit message include a Fixes tag:

  Fixes: c2d3a7300695 ("drm/syncobj: Extend EXPORT_SYNC_FILE for timeline syncobjs")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261106095730.166-1-tongzhiwei@cmss.chinamobile.com?part=1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-06 10:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-06  9:57 [PATCH] drm/syncobj: Fix fence and syncobj leak on dma_fence_chain_alloc failure tongzhiwei
2026-11-06 10:10 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.