From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/nouveau: Handle NVIF_CONN_TV and fix error cleanup in nouveau_connector_create()
Date: Thu, 19 Nov 2026 17:13:14 +0000 [thread overview]
Message-ID: <sashiko-outbox-223654@kernel.org> (raw)
In-Reply-To: <f0db7ca640d19d1021b4031b08be426532425095.1795106937.git.irogers@google.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] drm/nouveau: missing drm_connector_cleanup() in
nouveau_connector_create() [1]
--
commit 35127d593c69f43f2dbfc8d677382d137440fa37
Author: Ian Rogers <irogers@google.com>
drm/nouveau: Handle NVIF_CONN_TV and fix error cleanup in nouveau_connector_create()
This commit maps NVIF_CONN_TV to DCB_CONNECTOR_TV_0 in
nouveau_connector_create() and cleans up nv_connector->conn and
nv_connector before returning ERR_PTR(-EINVAL) in the default switch case.
> diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
> index e472c23c29811..22545fd06e05b 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_connector.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
> @@ -1437,6 +1437,9 @@ nouveau_connector_create(struct drm_device *dev, int index)
>
> switch (nv_connector->conn.info.type) {
> case NVIF_CONN_VGA : type = DCB_CONNECTOR_VGA; break;
> + case NVIF_CONN_TV:
> + type = DCB_CONNECTOR_TV_0;
> + break;
> case NVIF_CONN_DVI_I : type = DCB_CONNECTOR_DVI_I; break;
> case NVIF_CONN_DVI_D : type = DCB_CONNECTOR_DVI_D; break;
> case NVIF_CONN_LVDS : type = DCB_CONNECTOR_LVDS; break;
> @@ -1446,7 +1449,9 @@ nouveau_connector_create(struct drm_device *dev, int index)
> case NVIF_CONN_HDMI : type = DCB_CONNECTOR_HDMI_0; break;
> default:
> WARN_ON(1);
> - return NULL;
> + nvif_conn_dtor(&nv_connector->conn);
> + kfree(nv_connector);
> + return ERR_PTR(-EINVAL);
> }
>
> nv_connector->type = type;
[Severity: High]
This problem wasn't introduced by this patch, but later in
nouveau_connector_create(), does the LVDS error path [1] free
nv_connector without calling drm_connector_cleanup()?
drivers/gpu/drm/nouveau/nouveau_connector.c:nouveau_connector_create() {
...
drm_connector_init(dev, connector, funcs, type);
switch (type) {
case DRM_MODE_CONNECTOR_LVDS:
ret = nouveau_bios_parse_lvds_table(dev, 0, &dummy, &dummy);
if (ret) {
NV_ERROR(drm, "Error parsing LVDS table, disabling\n");
kfree(nv_connector);
return ERR_PTR(ret);
}
...
}
If nouveau_bios_parse_lvds_table() fails after drm_connector_init() has
registered connector with the DRM core, calling kfree(nv_connector)
directly leaks the connector IDA and leaves a dangling pointer on the DRM
connector list, causing a use-after-free when the list is later traversed
or torn down.
[1] https://sashiko.dev/#/bug/linux-5fc9af31-e33a-4535-9e9a-4dc95a2d84c3
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1795106937.git.irogers@google.com?part=1
next prev parent reply other threads:[~2026-11-19 17:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 17:03 [PATCH 0/2] drm/nouveau: Two fixes from Clang warning audit Ian Rogers
2026-11-19 17:03 ` [PATCH 1/2] drm/nouveau: Handle NVIF_CONN_TV and fix error cleanup in nouveau_connector_create() Ian Rogers
2026-11-19 17:13 ` sashiko-bot [this message]
2026-11-19 17:03 ` [PATCH 2/2] drm/nouveau/kms: Initialize primary_crc for RG CRC capture on GB20x Ian Rogers
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=sashiko-outbox-223654@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=irogers@google.com \
--cc=sashiko-reviews@lists.linux.dev \
/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