From: Chengyu Liu <lui2012qwq@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: maarten.lankhorst@linux.intel.com, mripard@kernel.org,
tzimmermann@suse.de, Chengyu Liu <lui2012qwq@gmail.com>
Subject: [PATCH] drm/gem-atomic-helper: fix fence leak on dma_fence_chain_alloc() failure
Date: Sun, 8 Nov 2026 00:53:03 +0800 [thread overview]
Message-ID: <20261107165303.13508-1-lui2012qwq@gmail.com> (raw)
In drm_gem_plane_helper_prepare_fb(), when both "new" (the plane's GEM
singleton fence) and "fence" (explicit or previous plane's) exist, they
are wrapped in a freshly allocated chain. If dma_fence_chain_alloc()
fails, the error path runs before dma_fence_chain_init() adopts "new",
and error: only puts "fence" - leaking one fence reference per failure.
Put "new" in the allocation-failure branch.
Found by static analysis.
Signed-off-by: Chengyu Liu <lui2012qwq@gmail.com>
---
drivers/gpu/drm/drm_gem_atomic_helper.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/drm_gem_atomic_helper.c b/drivers/gpu/drm/drm_gem_atomic_helper.c
index abef865c5f2c..1e484f26ab31 100644
--- a/drivers/gpu/drm/drm_gem_atomic_helper.c
+++ b/drivers/gpu/drm/drm_gem_atomic_helper.c
@@ -153,6 +153,7 @@
if (new && fence) {
struct dma_fence_chain *chain = dma_fence_chain_alloc();
if (!chain) {
+ dma_fence_put(new);
ret = -ENOMEM;
goto error;
}
--
2.25.1
next reply other threads:[~2026-11-09 9:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 16:53 Chengyu Liu [this message]
2026-11-09 9:50 ` [PATCH] drm/gem-atomic-helper: fix fence leak on dma_fence_chain_alloc() failure sashiko-bot
2026-11-12 15:52 ` Chengyu Liu
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=20261107165303.13508-1-lui2012qwq@gmail.com \
--to=lui2012qwq@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@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 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.