From: Wentao Liang <vulab@iscas.ac.cn>
To: maarten.lankhorst@linux.intel.com, mripard@kernel.org,
tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Wentao Liang <vulab@iscas.ac.cn>,
stable@vger.kernel.org
Subject: [PATCH] gpu/drm/drm_syncobj: fix fence and syncobj refcount leak in drm_syncobj_import_sync_file_fence()
Date: Mon, 25 May 2026 02:54:55 +0000 [thread overview]
Message-ID: <20260525025455.3887523-1-vulab@iscas.ac.cn> (raw)
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
next reply other threads:[~2026-05-25 2:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-25 2:54 Wentao Liang [this message]
2026-05-25 6:49 ` Claude review: gpu/drm/drm_syncobj: fix fence and syncobj refcount leak in drm_syncobj_import_sync_file_fence() Claude Code Review Bot
2026-05-25 6:49 ` Claude Code Review Bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260525025455.3887523-1-vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=stable@vger.kernel.org \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox