From: sashiko-bot@kernel.org
To: "Mario Limonciello" <mario.limonciello@amd.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v7 12/12] drm/i915/display: use drm backlight
Date: Mon, 31 Aug 2026 23:55:38 +0000 [thread overview]
Message-ID: <20260831235538.E3F641F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260831210531.2334221-13-mario.limonciello@amd.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Low] Unused include `<drm/drm_backlight.h>` in `intel_dp.c`
Pre-existing issues:
- [High] TOCTOU race in sysfs backlight update leading to NULL pointer dereference during non-blocking display disable
--
commit 6982034de97212a1664f3db93710a699b08ecdab
Author: Mario Limonciello <mario.limonciello@amd.com>
drm/i915/display: use drm backlight
This commit converts the Intel display drivers (i915 and xe) to use the DRM
backlight infrastructure, allowing brightness control via the connector
LUMINANCE property. It links the backlight device to the eDP connector on
registration and unlinks it on unregistration.
> diff --git a/drivers/gpu/drm/i915/display/intel_backlight.c b/drivers/gpu/drm/i915/display/intel_backlight.c
> index b128896cb1c2d..b0cd4dc3adc00 100644
> --- a/drivers/gpu/drm/i915/display/intel_backlight.c
> +++ b/drivers/gpu/drm/i915/display/intel_backlight.c
[ ... ]
> @@ -1015,6 +1018,7 @@ void intel_backlight_device_unregister(struct intel_connector *connector)
> struct intel_panel *panel = &connector->panel;
>
> if (panel->backlight.device) {
> + drm_backlight_link(&connector->base, NULL);
> backlight_device_unregister(panel->backlight.device);
> panel->backlight.device = NULL;
> }
[Severity: High]
This is a pre-existing issue, but could this cause a NULL pointer dereference
during a non-blocking display disable?
If there is a concurrent userspace write to the legacy sysfs brightness file
during a non-blocking display disable on VLV/CHV hardware, we might hit a race.
During the non-blocking commit, connection_mutex is dropped before the hardware
is disabled, allowing intel_backlight_device_update_status() to execute.
It uses the newly swapped connector->base.state (where crtc = NULL), but
panel->backlight.enabled remains true until the asynchronous commit tail
disables it.
This seems to lead to intel_panel_set_backlight() passing the state directly
to the backend without checking if conn_state->crtc is NULL:
drivers/gpu/drm/i915/display/intel_backlight.c:intel_panel_set_backlight() {
...
if (panel->backlight.enabled)
intel_panel_actually_set_backlight(conn_state, hw_level);
...
}
Which then calls into vlv_set_backlight() where the NULL crtc is dereferenced:
drivers/gpu/drm/i915/display/intel_backlight.c:vlv_set_backlight() {
...
enum pipe pipe = to_intel_crtc(conn_state->crtc)->pipe;
u32 tmp;
tmp = intel_de_read(display, VLV_BLC_PWM_CTL(pipe)) & ~BACKLIGHT_DUTY_CYCLE_MASK;
intel_de_write(display, VLV_BLC_PWM_CTL(pipe), tmp | level);
...
}
Does this require a check for conn_state->crtc being NULL before passing the
state, similar to how other backlight functions handle it?
[ ... ]
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 113d767e62e9c..2381a80a4e671 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -43,6 +43,7 @@
> #include <drm/display/drm_dsc_helper.h>
> #include <drm/display/drm_hdmi_helper.h>
> #include <drm/drm_atomic_helper.h>
> +#include <drm/drm_backlight.h>
> #include <drm/drm_crtc.h>
> #include <drm/drm_edid.h>
> #include <drm/drm_fixed.h>
[Severity: Low]
Is this include used anywhere in this file?
It looks like <drm/drm_backlight.h> is added to intel_dp.c but no symbols from
it are utilized in this file, resulting in a dead include.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260831210531.2334221-1-mario.limonciello@amd.com?part=12
next prev parent reply other threads:[~2026-08-31 23:55 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 21:05 [PATCH v7 00/12] Add support for a DRM backlight capability Mario Limonciello
2026-08-31 21:05 ` [PATCH v7 01/12] Revert "backlight: Remove notifier" Mario Limonciello
2026-08-31 22:02 ` sashiko-bot
2026-08-31 21:05 ` [PATCH v7 02/12] backlight: add kernel-internal backlight API Mario Limonciello
2026-08-31 22:11 ` sashiko-bot
2026-08-31 21:05 ` [PATCH v7 03/12] drm/property: add a per-connector luminance flag Mario Limonciello
2026-08-31 21:05 ` [PATCH v7 04/12] drm: add connector backlight (LUMINANCE) infrastructure Mario Limonciello
2026-08-31 22:28 ` sashiko-bot
2026-08-31 21:05 ` [PATCH v7 05/12] drm: add DRM_CLIENT_CAP_LUMINANCE Mario Limonciello
2026-08-31 22:37 ` sashiko-bot
2026-08-31 21:05 ` [PATCH v7 06/12] drm/amd/display: Pass up errors reading actual brightness Mario Limonciello
2026-08-31 22:49 ` sashiko-bot
2026-08-31 21:05 ` [PATCH v7 07/12] drm/amd: Indicate driver supports luminance Mario Limonciello
2026-08-31 21:05 ` [PATCH v7 08/12] drm/amd/display: use drm backlight Mario Limonciello
2026-08-31 23:12 ` sashiko-bot
2026-08-31 21:05 ` [PATCH v7 09/12] drm/bridge: auto-link panel backlight in bridge connector Mario Limonciello
2026-08-31 23:24 ` sashiko-bot
2026-08-31 21:05 ` [PATCH v7 10/12] drm/xe: Indicate support for luminance on the connector Mario Limonciello
2026-08-31 23:30 ` sashiko-bot
2026-08-31 21:05 ` [PATCH v7 11/12] drm/i915: " Mario Limonciello
2026-08-31 21:05 ` [PATCH v7 12/12] drm/i915/display: use drm backlight Mario Limonciello
2026-08-31 23:55 ` sashiko-bot [this message]
2026-09-01 0:19 ` [PATCH v7 00/12] Add support for a DRM backlight capability Mario Limonciello
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=20260831235538.E3F641F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=mario.limonciello@amd.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