From: sashiko-bot@kernel.org
To: "Maxime Ripard" <mripard@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 70/75] drm/nouveau: Convert to atomic_create_state
Date: Wed, 14 Oct 2026 18:13:12 +0000 [thread overview]
Message-ID: <sashiko-outbox-171678@kernel.org> (raw)
In-Reply-To: <20261014-drm-no-more-connector-reset-v1-70-586c9c026823@kernel.org>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] drm/nouveau: Assigning ERR_PTR to connector->state causes panic in cleanup
- [High] drm/nouveau: Invalid kfree of embedded connector state on non-atomic devices
- [Medium] drm/nouveau: MST connectors lose DRM properties on initialization
--
commit 5c80f0bbb55c00fa7eb36613e602205469912331
Author: Maxime Ripard <mripard@kernel.org>
drm/nouveau: Convert to atomic_create_state
The nouveau connector reset implementation creates a custom state
subclass, but only initializes a pristine state and sets
driver-specific defaults without resetting any hardware. This is
equivalent to what atomic_create_state expects. Convert to it.
> diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> index e91130f93db67..39a23d0e9be56 100644
> --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
> +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
[ ... ]
> @@ -1281,8 +1281,11 @@ nv50_mstc_new(struct nv50_mstm *mstm, struct drm_dp_mst_port *port,
>
> drm_connector_helper_add(&mstc->connector, &nv50_mstc_help);
>
> - mstc->connector.funcs->reset(&mstc->connector);
> - nouveau_conn_attach_properties(&mstc->connector);
> + mstc->connector.state = mstc->connector.funcs->atomic_create_state(&mstc->connector);
[Severity: Medium]
Will dropping this call to nouveau_conn_attach_properties() cause MST
connectors to silently lose access to their DRM properties?
Before this patch, MST connectors would get properties like underscan_property,
scaling_mode_property, dithering_mode, and vibrant_hue registered here.
Without this call, userspace compositors might lose access to these standard
digital output properties.
[Severity: High]
If atomic_create_state() returns an error pointer, this assigns it directly
to mstc->connector.state.
> + if (IS_ERR(mstc->connector.state)) {
> + drm_connector_cleanup(&mstc->connector);
Could passing this error pointer to drm_connector_cleanup() result in a kernel
panic?
If we take this error path, drm_connector_cleanup() checks if connector->state
is set (which is true for ERR_PTR), and calls atomic_destroy_state().
This passes the error pointer down to nouveau_conn_atomic_destroy_state(),
which will dereference the invalid pointer and panic.
> + return PTR_ERR(mstc->connector.state);
> + }
>
> drm_for_each_crtc(crtc, dev) {
> if (!(mstm->outp->dcb->heads & drm_crtc_mask(crtc)))
> diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
> index cc3caf8de64b0..59c8091c67967 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_connector.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
[ ... ]
> @@ -242,21 +242,17 @@ nouveau_conn_atomic_duplicate_state(struct drm_connector *connector)
> return &asyc->state;
> }
>
> -void
> -nouveau_conn_reset(struct drm_connector *connector)
> +struct drm_connector_state *
> +nouveau_conn_atomic_create_state(struct drm_connector *connector)
> {
> struct nouveau_connector *nv_connector = nouveau_connector(connector);
> struct nouveau_conn_atom *asyc;
>
> if (drm_drv_uses_atomic_modeset(connector->dev)) {
> if (WARN_ON(!(asyc = kzalloc_obj(*asyc))))
> - return;
> + return ERR_PTR(-ENOMEM);
>
> - if (connector->state)
> - nouveau_conn_atomic_destroy_state(connector,
> - connector->state);
> -
> - __drm_atomic_helper_connector_reset(connector, &asyc->state);
> + __drm_atomic_helper_connector_state_init(&asyc->state, connector);
> } else {
> asyc = &nv_connector->properties_state;
> }
[Severity: High]
On older non-atomic hardware (pre-NV50), this returns a pointer to the
statically embedded nv_connector->properties_state.
The caller nouveau_connector_create() now unconditionally assigns this returned
pointer to connector->state. When the connector is later destroyed or reset,
drm_connector_cleanup() will invoke nouveau_conn_atomic_destroy_state(),
which unconditionally calls kfree() on the state pointer.
Can calling kfree() on this statically embedded struct pointer cause memory
corruption and a kernel panic?
[ ... ]
> @@ -1521,7 +1519,12 @@ nouveau_connector_create(struct drm_device *dev, int index)
> }
> }
>
> - connector->funcs->reset(connector);
> + connector->state = connector->funcs->atomic_create_state(connector);
> + if (IS_ERR(connector->state)) {
> + ret = PTR_ERR(connector->state);
> + goto drm_conn_err;
[Severity: High]
Similar to the issue in nv50_mstc_new(), if atomic_create_state() fails,
the error pointer is assigned to connector->state.
The goto drm_conn_err path calls drm_connector_cleanup(), which will attempt to
clean up the state using the error pointer.
Does this lead to a panic during the error path cleanup?
> + }
> +
> nouveau_conn_attach_properties(connector);
>
> /* Default scaling mode */
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261014-drm-no-more-connector-reset-v1-0-586c9c026823@kernel.org?part=70
next prev parent reply other threads:[~2026-10-14 18:13 UTC|newest]
Thread overview: 98+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 17:26 [PATCH 00/75] drm/connector: Convert all drivers to atomic_create_state and remove reset Maxime Ripard
2026-10-14 17:26 ` Maxime Ripard
2026-10-14 17:26 ` [PATCH 01/75] drm/panel: Add atomic_create_state support Maxime Ripard
2026-10-14 17:45 ` sashiko-bot
2026-10-14 17:26 ` [PATCH 02/75] drm/adp: Switch to drm_atomic_helper_connector_create_state Maxime Ripard
2026-10-14 17:26 ` [PATCH 03/75] drm/amdgpu: vkms: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 04/75] drm/amdgpu: dm: " Maxime Ripard
2026-10-14 17:52 ` sashiko-bot
2026-10-14 17:26 ` [PATCH 05/75] drm/arm: komeda: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 06/75] drm/aspeed: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 07/75] drm/ast: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 08/75] drm/bridge: analogix-anx6345: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 09/75] drm/bridge: analogix-anx78xx: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 10/75] drm/bridge: chrontel-ch7033: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 11/75] drm/bridge: lontium-lt8912b: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 12/75] drm/bridge: megachips: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 13/75] drm/bridge: nxp-ptn3460: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 14/75] drm/panel: " Maxime Ripard
2026-10-14 17:48 ` sashiko-bot
2026-10-14 17:26 ` [PATCH 15/75] drm/bridge: sii902x: " Maxime Ripard
2026-10-14 18:26 ` Dmitry Baryshkov
2026-10-14 17:26 ` [PATCH 16/75] drm/bridge: simple-bridge: " Maxime Ripard
2026-10-14 18:27 ` Dmitry Baryshkov
2026-10-14 17:26 ` [PATCH 17/75] drm/bridge: synopsys: dw-hdmi: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 18/75] drm/bridge: tc358767: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 19/75] drm/bridge: tda998x: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 20/75] drm/bridge: ti-tfp410: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 21/75] drm/exynos: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 22/75] drm/fsl-dcu: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 23/75] drm/hisilicon: hibmc: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 24/75] drm/hyperv: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 25/75] drm/imx: ipuv3: " Maxime Ripard
2026-10-14 18:38 ` Frank Li
2026-10-14 17:26 ` [PATCH 26/75] drm/logicvc: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 27/75] drm/loongson: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 28/75] drm/mgag200: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 29/75] drm/mipi-dbi: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 30/75] drm/msm: dpu1: " Maxime Ripard
2026-10-14 18:25 ` Dmitry Baryshkov
2026-10-14 17:26 ` [PATCH 31/75] drm/qxl: " Maxime Ripard
2026-10-14 17:53 ` sashiko-bot
2026-10-14 17:26 ` [PATCH 32/75] drm/renesas: shmobile: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 33/75] drm/sitronix: st7571: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 34/75] drm/sitronix: st7920: " Maxime Ripard
2026-10-14 17:26 ` [PATCH 35/75] drm/solomon: ssd130x: " Maxime Ripard
2026-10-14 20:21 ` Javier Martinez Canillas
2026-10-14 17:26 ` [PATCH 36/75] drm/sti: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 37/75] drm/stm: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 38/75] drm/sun4i: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 39/75] drm/sysfb: " Maxime Ripard
2026-10-14 20:21 ` Javier Martinez Canillas
2026-10-14 17:27 ` [PATCH 40/75] drm/tegra: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 41/75] drm/tests: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 42/75] drm/tiny: arcpgu: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 43/75] drm/tiny: bochs: " Maxime Ripard
2026-10-14 17:56 ` sashiko-bot
2026-10-14 17:27 ` [PATCH 44/75] drm/tiny: cirrus: " Maxime Ripard
2026-10-14 17:57 ` sashiko-bot
2026-10-14 17:27 ` [PATCH 45/75] drm/tiny: gm12u320: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 46/75] drm/tiny: pixpaper: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 47/75] drm/tiny: repaper: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 48/75] drm/tiny: sharp: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 49/75] drm/udl: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 50/75] drm/vboxvideo: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 51/75] drm/vc4: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 52/75] drm/virtio: " Maxime Ripard
2026-10-14 18:10 ` sashiko-bot
2026-10-14 17:27 ` [PATCH 53/75] drm/vkms: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 54/75] drm/xen: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 55/75] drm/atomic-state-helper: Rename connector_tv_margins_reset to state_init Maxime Ripard
2026-10-14 17:27 ` [PATCH 56/75] drm/atomic-state-helper: Rename connector_tv_reset " Maxime Ripard
2026-10-14 18:03 ` sashiko-bot
2026-10-14 17:27 ` [PATCH 57/75] drm/bridge: synopsys: dw-hdmi: Convert to atomic_create_state Maxime Ripard
2026-10-14 18:14 ` sashiko-bot
2026-10-14 17:27 ` [PATCH 58/75] drm/meson: " Maxime Ripard
2026-10-14 17:27 ` Maxime Ripard
2026-10-14 17:27 ` [PATCH 59/75] drm/gud: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 60/75] drm/sun4i: hdmi: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 61/75] drm/sun4i: tv: " Maxime Ripard
2026-10-14 18:08 ` sashiko-bot
2026-10-14 17:27 ` [PATCH 62/75] drm/tests: hdmi: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 63/75] drm/vc4: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 64/75] drm/vc4: vec: " Maxime Ripard
2026-10-14 18:10 ` sashiko-bot
2026-10-14 17:27 ` [PATCH 65/75] drm/connector: Remove drm_atomic_helper_connector_reset() Maxime Ripard
2026-10-14 17:27 ` [PATCH 66/75] drm/amdgpu: dm: Convert to atomic_create_state Maxime Ripard
2026-10-14 18:16 ` sashiko-bot
2026-10-14 17:27 ` [PATCH 67/75] drm/malidp: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 68/75] drm/ast: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 69/75] drm/i915: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 70/75] drm/nouveau: " Maxime Ripard
2026-10-14 17:27 ` Maxime Ripard
2026-10-14 18:13 ` sashiko-bot [this message]
2026-10-14 17:27 ` [PATCH 71/75] drm/rcar-du: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 72/75] drm/tegra: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 73/75] drm/vmwgfx: " Maxime Ripard
2026-10-14 17:27 ` [PATCH 74/75] drm/connector: Remove __drm_atomic_helper_connector_reset() Maxime Ripard
2026-10-14 17:27 ` [PATCH 75/75] drm/connector: Remove reset Maxime Ripard
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-171678@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=mripard@kernel.org \
--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 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.