From: Shuhao Fu <sfual@cse.ust.hk>
To: Lyude Paul <lyude@redhat.com>, Danilo Krummrich <dakr@kernel.org>
Cc: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org,
stable@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3] drm/nouveau: Fix refcount leak in nouveau_connector_detect
Date: Wed, 8 Oct 2025 11:20:03 +0800 [thread overview]
Message-ID: <aOXYV5pgilTvqMxR@osx.local> (raw)
In-Reply-To: <aOPy5aCiRTqb9kjR@homelab>
A possible inconsistent refcount update has been identified in function
`nouveau_connector_detect`, which may cause a resource leak.
After calling `pm_runtime_get_*(dev->dev)`, the usage counter of `dev->dev`
gets increased. In case function `nvif_outp_edid_get` returns negative,
function `nouveau_connector_detect` returns without decreasing the usage
counter of `dev->dev`, causing a refcount inconsistency.
Closes: https://gitlab.freedesktop.org/drm/nouveau/-/issues/450
Fixes: 0cd7e0718139 ("drm/nouveau/disp: add output method to fetch edid")
Signed-off-by: Shuhao Fu <sfual@cse.ust.hk>
Cc: stable@vger.kernel.org
Change in v3:
- Cc stable
Change in v2:
- Add "Fixes" and "Cc" tags
---
drivers/gpu/drm/nouveau/nouveau_connector.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 63621b151..45caccade 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -600,8 +600,10 @@ nouveau_connector_detect(struct drm_connector *connector, bool force)
new_edid = drm_get_edid(connector, nv_encoder->i2c);
} else {
ret = nvif_outp_edid_get(&nv_encoder->outp, (u8 **)&new_edid);
- if (ret < 0)
- return connector_status_disconnected;
+ if (ret < 0) {
+ conn_status = connector_status_disconnected;
+ goto out;
+ }
}
nouveau_connector_set_edid(nv_connector, new_edid);
--
2.39.5
next prev parent reply other threads:[~2025-12-13 12:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-06 16:48 [PATCH] drm/nouveau: Fix refcount leak in nouveau_connector_detect Shuhao Fu
2025-10-06 20:38 ` Danilo Krummrich
2025-10-06 21:43 ` Lyude Paul
2025-10-07 4:03 ` [PATCH v2] " Shuhao Fu
2025-10-08 3:20 ` Shuhao Fu [this message]
2025-10-21 17:02 ` [PATCH v3] " Shuhao Fu
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=aOXYV5pgilTvqMxR@osx.local \
--to=sfual@cse.ust.hk \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lyude@redhat.com \
--cc=nouveau@lists.freedesktop.org \
--cc=stable@vger.kernel.org \
/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.