public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] gpu/drm/drm_syncobj: fix fence and syncobj refcount leak in drm_syncobj_import_sync_file_fence()
@ 2026-05-25  2:54 Wentao Liang
  2026-05-25  6:49 ` Claude review: " Claude Code Review Bot
  2026-05-25  6:49 ` Claude Code Review Bot
  0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2026-05-25  2:54 UTC (permalink / raw)
  To: maarten.lankhorst, mripard, tzimmermann, airlied, simona
  Cc: dri-devel, linux-kernel, Wentao Liang, stable

In drm_syncobj_import_sync_file_fence(), when point is non-zero and
dma_fence_chain_alloc() fails, the function returns -ENOMEM without
releasing the fence reference (obtained via sync_file_get_fence)
and the syncobj reference (obtained via drm_syncobj_find).

Add dma_fence_put() and drm_syncobj_put() calls on the error path
to properly release both references.

Cc: stable@vger.kernel.org
Fixes: c2d3a7300695 ("drm/syncobj: Extend EXPORT_SYNC_FILE for timeline syncobjs")
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 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 0e986daa8ff9..34c87698e316 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -745,8 +745,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.34.1


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

end of thread, other threads:[~2026-05-25  6:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-25  2:54 [PATCH] gpu/drm/drm_syncobj: fix fence and syncobj refcount leak in drm_syncobj_import_sync_file_fence() Wentao Liang
2026-05-25  6:49 ` Claude review: " Claude Code Review Bot
2026-05-25  6:49 ` Claude Code Review Bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox