From: sashiko-bot@kernel.org
To: "Maxime Ripard" <mripard@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH RESEND 45/83] drm/sti: Switch to drm_mode_config_create_initial_state
Date: Thu, 05 Nov 2026 20:07:59 +0000 [thread overview]
Message-ID: <sashiko-outbox-200075@kernel.org> (raw)
In-Reply-To: <20261105-drm-no-more-config-reset-v1-45-1f58d1e33380@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/sti: late initial state creation and broken error unwind in sti_bind()
--
commit 90a65d66556bc446b84f7842f4301480a5997e74
Author: Maxime Ripard <mripard@kernel.org>
drm/sti: Switch to drm_mode_config_create_initial_state
This commit replaces the call to drm_mode_config_reset() in sti_bind() with
drm_mode_config_create_initial_state() and adds an error path to unregister
the DRM device if initial state creation fails.
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index d02d71866f2a9..0ca6c6b41f18d 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -202,12 +202,16 @@ static int sti_bind(struct device *dev)
> if (ret)
> goto err_cleanup;
>
> - drm_mode_config_reset(ddev);
> + ret = drm_mode_config_create_initial_state(ddev);
> + if (ret)
> + goto err_unregister;
>
> drm_client_setup(ddev, NULL);
>
> return 0;
>
> +err_unregister:
> + drm_dev_unregister(ddev);
> err_cleanup:
> sti_cleanup(ddev);
[Severity: High]
If drm_mode_config_create_initial_state() fails in sti_bind() (for example,
when plane or CRTC state allocation fails with -ENOMEM), jumping to
err_unregister and falling through to err_cleanup calls sti_cleanup():
drivers/gpu/drm/sti/sti_drv.c:sti_cleanup() {
...
drm_kms_helper_poll_fini(ddev);
drm_atomic_helper_shutdown(ddev);
drm_mode_config_cleanup(ddev);
...
}
Because crtc->state is still NULL when initial state creation fails before
allocating CRTC states (or when drm_dev_register() fails before initial state
creation is reached), does calling
sti_cleanup() -> drm_atomic_helper_shutdown() ->
drm_atomic_helper_disable_all() -> drm_atomic_get_crtc_state() ->
drm_atomic_helper_crtc_duplicate_state() trigger a WARN_ON(!crtc->state) and
cause drm_atomic_helper_shutdown() to fail?
In addition, in sti_bind(), drm_dev_register() is called right before
drm_mode_config_create_initial_state():
drivers/gpu/drm/sti/sti_drv.c:sti_bind() {
...
ret = drm_dev_register(ddev, 0);
if (ret)
goto err_cleanup;
ret = drm_mode_config_create_initial_state(ddev);
if (ret)
goto err_unregister;
...
}
Since drm_dev_register() exposes the DRM device nodes and connector sysfs
attributes to userspace while plane->state, crtc->state, and
connector->state are still NULL, and drm_mode_config_create_initial_state()
subsequently populates those state pointers without holding modeset locks,
can a userspace process opening the device right after registration trigger
a NULL pointer dereference in drm_mode_object_get_properties() ->
drm_atomic_get_property()?
Should drm_mode_config_create_initial_state() be called before
drm_dev_register(), and should drm_atomic_helper_shutdown() be avoided on
error paths where initial modeset state has not been fully created?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261105-drm-no-more-config-reset-v1-0-1f58d1e33380@kernel.org?part=45
next prev parent reply other threads:[~2026-11-05 20:08 UTC|newest]
Thread overview: 113+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 15:29 [PATCH RESEND 00/83] drm: Switch drivers to drm_mode_config_create_initial_state Maxime Ripard
2026-11-05 15:29 ` Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 01/83] drm/adp: Switch " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 02/83] drm/amdgpu: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 03/83] drm/appletbdrm: " Maxime Ripard
2026-11-05 17:41 ` Aditya Garg
2026-11-05 15:29 ` [PATCH RESEND 04/83] drm/komeda: " Maxime Ripard
2026-11-05 15:46 ` Liviu Dudau
2026-11-05 15:29 ` [PATCH RESEND 05/83] drm/hdlcd: " Maxime Ripard
2026-11-05 15:46 ` Liviu Dudau
2026-11-05 16:30 ` sashiko-bot
2026-11-05 15:29 ` [PATCH RESEND 06/83] drm/malidp: " Maxime Ripard
2026-11-05 15:46 ` Liviu Dudau
2026-11-05 15:29 ` [PATCH RESEND 07/83] drm/armada: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 08/83] drm/aspeed: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 09/83] drm/ast: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 10/83] drm/atmel-hlcdc: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 11/83] drm/exynos: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 12/83] drm/fsl-dcu: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 13/83] drm/gud: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 14/83] drm/hisilicon/hibmc: " Maxime Ripard
2026-11-05 17:25 ` sashiko-bot
2026-11-05 15:29 ` [PATCH RESEND 15/83] drm/hisilicon/kirin: " Maxime Ripard
2026-11-05 19:35 ` John Stultz
2026-11-05 15:29 ` [PATCH RESEND 16/83] drm/hyperv: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 17/83] drm/imx/dc: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 18/83] drm/imx/dcss: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 19/83] drm/imx/ipuv3: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 20/83] drm/ingenic: " Maxime Ripard
2026-11-05 15:56 ` Paul Cercueil
2026-11-05 18:12 ` sashiko-bot
2026-11-05 15:29 ` [PATCH RESEND 21/83] drm/kmb: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 22/83] drm/logicvc: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 23/83] drm/loongson: " Maxime Ripard
2026-11-05 18:28 ` sashiko-bot
2026-11-05 15:29 ` [PATCH RESEND 24/83] drm/mcde: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 25/83] drm/mediatek: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 26/83] drm/meson: " Maxime Ripard
2026-11-05 15:29 ` Maxime Ripard
2026-11-05 15:52 ` neil.armstrong
2026-11-05 15:52 ` neil.armstrong
2026-11-05 15:29 ` [PATCH RESEND 27/83] drm/mgag200: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 28/83] drm/msm: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 29/83] drm/lcdif: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 30/83] drm/mxsfb: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 31/83] drm/nouveau: " Maxime Ripard
2026-11-05 15:29 ` Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 32/83] drm/omap: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 33/83] drm/pl111: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 34/83] drm/qxl: " Maxime Ripard
2026-11-05 19:32 ` sashiko-bot
2026-11-05 15:29 ` [PATCH RESEND 35/83] drm/rcar-du: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 36/83] drm/rz-du: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 37/83] drm/shmobile: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 38/83] drm/rockchip: " Maxime Ripard
2026-11-05 15:29 ` Maxime Ripard
2026-11-05 19:05 ` Heiko Stübner
2026-11-05 19:05 ` Heiko Stübner
2026-11-05 15:29 ` [PATCH RESEND 39/83] drm/st7571: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 40/83] drm/st7586: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 41/83] drm/st7735r: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 42/83] drm/st7920: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 43/83] drm/ssd130x: " Maxime Ripard
2026-11-05 15:53 ` Javier Martinez Canillas
2026-11-05 15:29 ` [PATCH RESEND 44/83] drm/sprd: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 45/83] drm/sti: " Maxime Ripard
2026-11-05 20:07 ` sashiko-bot [this message]
2026-11-05 15:29 ` [PATCH RESEND 46/83] drm/stm: " Maxime Ripard
2026-11-05 15:29 ` [PATCH RESEND 47/83] drm/sun4i: " Maxime Ripard
2026-11-05 15:37 ` Chen-Yu Tsai
2026-11-05 15:29 ` [PATCH RESEND 48/83] drm/corebootdrm: " Maxime Ripard
2026-11-05 15:54 ` Javier Martinez Canillas
2026-11-05 15:29 ` [PATCH RESEND 49/83] drm/efidrm: " Maxime Ripard
2026-11-05 15:55 ` Javier Martinez Canillas
2026-11-05 15:29 ` [PATCH RESEND 50/83] drm/ofdrm: " Maxime Ripard
2026-11-05 15:56 ` Javier Martinez Canillas
2026-11-05 15:30 ` [PATCH RESEND 51/83] drm/simpledrm: " Maxime Ripard
2026-11-05 15:56 ` Javier Martinez Canillas
2026-11-05 15:30 ` [PATCH RESEND 52/83] drm/vesadrm: " Maxime Ripard
2026-11-05 15:57 ` Javier Martinez Canillas
2026-11-05 15:30 ` [PATCH RESEND 53/83] drm/tegra: " Maxime Ripard
2026-11-05 15:51 ` Thierry Reding
2026-11-05 15:30 ` [PATCH RESEND 54/83] drm/tests: drm_atomic_state_test: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 55/83] drm/tests: drm_atomic_test: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 56/83] drm/tests: drm_bridge_test: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 57/83] drm/tests: drm_hdmi_state_helper_test: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 58/83] drm/tidss: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 59/83] drm/tilcdc: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 60/83] drm/arcpgu: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 61/83] drm/bochs: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 62/83] drm/cirrus-qemu: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 63/83] drm/gm12u320: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 64/83] drm/hx8357d: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 65/83] drm/ili9163: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 66/83] drm/ili9225: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 67/83] drm/ili9341: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 68/83] drm/ili9486: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 69/83] drm/mi0283qt: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 70/83] drm/panel-mipi-dbi: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 71/83] drm/pixpaper: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 72/83] drm/repaper: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 73/83] drm/sharp-memory: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 74/83] drm/tve200: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 75/83] drm/udl: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 76/83] drm/vboxvideo: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 77/83] drm/vc4: " Maxime Ripard
2026-11-05 16:06 ` Dave Stevenson
2026-11-05 15:30 ` [PATCH RESEND 78/83] drm/verisilicon: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 79/83] drm/virtio: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 80/83] drm/vkms: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 81/83] drm/vmwgfx: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 82/83] drm/xen: " Maxime Ripard
2026-11-05 15:30 ` [PATCH RESEND 83/83] drm/xlnx: " 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-200075@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.