From: sashiko-bot@kernel.org
To: "Lyude Paul" <lyude@redhat.com>
Cc: linux-sunxi@lists.linux.dev, Frank.Li@kernel.org,
dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
linux-hyperv@vger.kernel.org, neil.armstrong@linaro.org,
linux-amlogic@lists.infradead.org,
wsa+renesas@sang-engineering.com, intel-xe@lists.freedesktop.org,
imx@lists.linux.dev
Subject: Re: [PATCH 5/5] drm/vblank: Require all CRTCs implement vblank support in drm_vblank_init()
Date: Fri, 14 Aug 2026 21:08:39 +0000 [thread overview]
Message-ID: <20260814210839.AC6AF1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260814203542.1405135-6-lyude@redhat.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm_vblank_init() causes a NULL pointer dereference or driver probe failure due to accessing uninitialized or empty crtc_list
--
--- Patch [5]: [PATCH 5/5] drm/vblank: Require all CRTCs implement vblank support in drm_vblank_init() ---
commit 178bbb448a16663eaad60425c62b446801e0f387
Author: Lyude Paul <lyude@redhat.com>
drm/vblank: Require all CRTCs implement vblank support in drm_vblank_init()
This commit modifies drm_vblank_init() to verify that all CRTCs implement
vblank support, ensuring an all-or-nothing configuration. It returns -EINVAL
if support is mixed, and -ENODEV if no CRTCs support vblank.
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index d57405050554f..17affae23e7a6 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -542,12 +542,31 @@ static void drm_vblank_init_release(struct drm_device *dev, void *ptr)
> * drmm_add_action_or_reset().
> *
> * Returns:
> - * Zero on success or a negative error code on failure.
> + * Zero on success or a negative error code on failure. If no CRTCs with vblank
> + * support implemented were found, -ENODEV will be returned.
> */
> int drm_vblank_init(struct drm_device *dev)
> {
> int ret;
> struct drm_crtc *crtc;
> + bool found_vbl_crtc = false, found_non_vbl_crtc = false;
> +
> + /* Vblank hooks are per-CRTC, not per-device - which is contrary to how
> + * the vblank core was written. Since hardware that only has vblank
> + * support on some CRTCs but not all is non-existent and would likely
> + * lead to UB, ensure that vblank support is all or nothing.
> + */
> + drm_for_each_crtc(crtc, dev) {
[Severity: High]
Can iterating over dev->mode_config.crtc_list here cause a NULL pointer
dereference or a false -ENODEV return during driver probe?
Several DRM drivers call drm_vblank_init() before initializing mode_config
or creating CRTCs. For example:
In i915, intel_display_driver_probe_noirq() calls drm_vblank_init() before
intel_mode_config_init() sets up the crtc_list, meaning the list head is
uninitialized.
In vkms, vkms_create() calls drm_vblank_init() before vkms_modeset_init()
initializes the crtc_list.
In zynqmp_kms, zynqmp_dpsub_drm_init() initializes the list but calls
drm_vblank_init() before any CRTCs are created, meaning the list is empty
and this function will unconditionally return -ENODEV.
Does drm_vblank_init() need to support being called before CRTCs are
registered?
> + if (crtc->funcs->enable_vblank)
> + found_vbl_crtc = true;
> + else
> + found_non_vbl_crtc = true;
> +
> + if (drm_WARN_ON(dev, found_vbl_crtc && found_non_vbl_crtc))
> + return -EINVAL;
> + }
> + if (!found_vbl_crtc)
> + return -ENODEV;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260814203542.1405135-1-lyude@redhat.com?part=5
WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Lyude Paul" <lyude@redhat.com>
Cc: linux-sunxi@lists.linux.dev, Frank.Li@kernel.org,
dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
linux-hyperv@vger.kernel.org, neil.armstrong@linaro.org,
linux-amlogic@lists.infradead.org,
wsa+renesas@sang-engineering.com, intel-xe@lists.freedesktop.org,
imx@lists.linux.dev
Subject: Re: [PATCH 5/5] drm/vblank: Require all CRTCs implement vblank support in drm_vblank_init()
Date: Fri, 14 Aug 2026 21:08:39 +0000 [thread overview]
Message-ID: <20260814210839.AC6AF1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260814203542.1405135-6-lyude@redhat.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm_vblank_init() causes a NULL pointer dereference or driver probe failure due to accessing uninitialized or empty crtc_list
--
--- Patch [5]: [PATCH 5/5] drm/vblank: Require all CRTCs implement vblank support in drm_vblank_init() ---
commit 178bbb448a16663eaad60425c62b446801e0f387
Author: Lyude Paul <lyude@redhat.com>
drm/vblank: Require all CRTCs implement vblank support in drm_vblank_init()
This commit modifies drm_vblank_init() to verify that all CRTCs implement
vblank support, ensuring an all-or-nothing configuration. It returns -EINVAL
if support is mixed, and -ENODEV if no CRTCs support vblank.
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index d57405050554f..17affae23e7a6 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -542,12 +542,31 @@ static void drm_vblank_init_release(struct drm_device *dev, void *ptr)
> * drmm_add_action_or_reset().
> *
> * Returns:
> - * Zero on success or a negative error code on failure.
> + * Zero on success or a negative error code on failure. If no CRTCs with vblank
> + * support implemented were found, -ENODEV will be returned.
> */
> int drm_vblank_init(struct drm_device *dev)
> {
> int ret;
> struct drm_crtc *crtc;
> + bool found_vbl_crtc = false, found_non_vbl_crtc = false;
> +
> + /* Vblank hooks are per-CRTC, not per-device - which is contrary to how
> + * the vblank core was written. Since hardware that only has vblank
> + * support on some CRTCs but not all is non-existent and would likely
> + * lead to UB, ensure that vblank support is all or nothing.
> + */
> + drm_for_each_crtc(crtc, dev) {
[Severity: High]
Can iterating over dev->mode_config.crtc_list here cause a NULL pointer
dereference or a false -ENODEV return during driver probe?
Several DRM drivers call drm_vblank_init() before initializing mode_config
or creating CRTCs. For example:
In i915, intel_display_driver_probe_noirq() calls drm_vblank_init() before
intel_mode_config_init() sets up the crtc_list, meaning the list head is
uninitialized.
In vkms, vkms_create() calls drm_vblank_init() before vkms_modeset_init()
initializes the crtc_list.
In zynqmp_kms, zynqmp_dpsub_drm_init() initializes the list but calls
drm_vblank_init() before any CRTCs are created, meaning the list is empty
and this function will unconditionally return -ENODEV.
Does drm_vblank_init() need to support being called before CRTCs are
registered?
> + if (crtc->funcs->enable_vblank)
> + found_vbl_crtc = true;
> + else
> + found_non_vbl_crtc = true;
> +
> + if (drm_WARN_ON(dev, found_vbl_crtc && found_non_vbl_crtc))
> + return -EINVAL;
> + }
> + if (!found_vbl_crtc)
> + return -ENODEV;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260814203542.1405135-1-lyude@redhat.com?part=5
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2026-08-14 21:08 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 20:35 [PATCH 0/5] drm/vblank: Enforce all-or-nothing vblank support Lyude Paul
2026-08-14 20:35 ` Lyude Paul
2026-08-14 20:35 ` Lyude Paul
2026-08-14 20:35 ` [PATCH 1/5] drm/vblank: Add drm_device.has_hw_vblank Lyude Paul
2026-08-14 20:35 ` Lyude Paul
2026-08-14 20:35 ` Lyude Paul
2026-08-14 20:35 ` [PATCH 2/5] drm/vblank: Remove drm->num_crtcs Lyude Paul
2026-08-14 20:35 ` Lyude Paul
2026-08-14 20:35 ` Lyude Paul
2026-08-14 20:35 ` [PATCH 3/5] drm/vblank: Remove num_crtcs argument from drm_vblank_init() Lyude Paul
2026-08-14 20:35 ` Lyude Paul
2026-08-14 20:35 ` Lyude Paul
2026-08-14 20:51 ` sashiko-bot
2026-08-14 20:51 ` sashiko-bot
2026-08-14 20:35 ` [PATCH 4/5] drm/vblank: Use drm_for_each_crtc() in drm_vblank_init() Lyude Paul
2026-08-14 20:35 ` Lyude Paul
2026-08-14 20:35 ` Lyude Paul
2026-08-14 20:56 ` sashiko-bot
2026-08-14 20:56 ` sashiko-bot
2026-08-14 20:35 ` [PATCH 5/5] drm/vblank: Require all CRTCs implement vblank support " Lyude Paul
2026-08-14 20:35 ` Lyude Paul
2026-08-14 20:35 ` Lyude Paul
2026-08-14 21:08 ` sashiko-bot [this message]
2026-08-14 21:08 ` sashiko-bot
2026-08-14 21:43 ` ✗ Fi.CI.BUILD: failure for drm/vblank: Enforce all-or-nothing vblank support Patchwork
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=20260814210839.AC6AF1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=imx@lists.linux.dev \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=lyude@redhat.com \
--cc=neil.armstrong@linaro.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wsa+renesas@sang-engineering.com \
/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.