From: sashiko-bot@kernel.org
To: "Mario Limonciello" <mario.limonciello@amd.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v6 09/10] drm/bridge: auto-link panel backlight in bridge connector
Date: Wed, 24 Jun 2026 17:13:06 +0000 [thread overview]
Message-ID: <20260624171306.7289C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260624165751.2014759-10-mario.limonciello@amd.com>
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
New issues:
- [High] NULL pointer dereference when calling drm_backlight_link() on an unregistered connector
- [Medium] Unconditional overwrite of return value 'ret' ignores drm_backlight_alloc() failures
- [Medium] Reference leak and WARN_ON if drm_connector_attach_encoder() fails
- [Low] Build failure due to missing static inline fallback for drm_panel_bridge_to_panel()
Pre-existing issues:
- [High] Sleeping in atomic context when drm_backlight_link() sends a uevent while holding a spinlock
--
commit 97d3e5fef0b8faac0a3e7bb0d3351e3d883fc3e8
Author: Mario Limonciello (AMD) <superm1@kernel.org>
drm/bridge: auto-link panel backlight in bridge connector
The link should allow clients to change luminance property.
Tested-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> # SM8150-HDK
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Tested-by: Simon Ser <contact@emersion.fr>
> diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c b/drivers/gpu/drm/display/drm_bridge_connector.c
> index 649969fca1413..23a3802294625 100644
> --- a/drivers/gpu/drm/display/drm_bridge_connector.c
> +++ b/drivers/gpu/drm/display/drm_bridge_connector.c
[ ... ]
> @@ -1051,9 +1053,20 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
> connector->polled = DRM_CONNECTOR_POLL_CONNECT
> | DRM_CONNECTOR_POLL_DISCONNECT;
>
> - if (panel_bridge)
> + if (panel_bridge) {
> + struct drm_panel *panel;
> +
> drm_panel_bridge_set_orientation(connector, panel_bridge);
>
> + panel = drm_panel_bridge_to_panel(panel_bridge);
> + if (panel && panel->backlight) {
> + ret = drm_backlight_alloc(connector);
> + if (!ret)
> + drm_backlight_link(connector->backlight,
> + panel->backlight);
[Severity: Medium]
If drm_backlight_alloc() returns an error code like -ENOMEM, is it safe to
ignore it?
The error code stored in 'ret' appears to be unconditionally overwritten by the
subsequent call to drm_connector_attach_encoder(), silently ignoring the
allocation failure.
[Severity: High]
Can calling drm_backlight_link() here cause a kernel panic?
This links the backlight during connector initialization, before the connector
is registered to sysfs.
In drivers/gpu/drm/drm_backlight.c:drm_backlight_link():
if (send_uevent)
kobject_uevent_env(&b->connector->kdev->kobj, KOBJ_CHANGE,
(char **)ep);
If connector->kdev is NULL at this point, sending a uevent could dereference
an invalid pointer.
[Severity: High]
This is a pre-existing issue, but does drm_backlight_link() sleep while
holding a spinlock?
In drivers/gpu/drm/drm_backlight.c:drm_backlight_link():
guard(spinlock)(&drm_backlight_lock);
send_uevent = __drm_backlight_link(b, bd);
if (send_uevent)
kobject_uevent_env(&b->connector->kdev->kobj, KOBJ_CHANGE,
(char **)ep);
The lock is held across the entire function scope, including the
kobject_uevent_env() call, which can allocate memory with GFP_KERNEL and
sleep. Could this trigger a 'scheduling while atomic' BUG?
> + }
> + }
> +
> if (support_hdcp && IS_REACHABLE(CONFIG_DRM_DISPLAY_HELPER) &&
> IS_ENABLED(CONFIG_DRM_DISPLAY_HDCP_HELPER))
> drm_connector_attach_content_protection_property(connector, true);
[Severity: Medium]
If drm_connector_attach_encoder() fails just after this block, does this leak
a reference to the backlight_device and trigger a WARN_ON?
This error path bails out without unlinking the backlight that was successfully
linked above:
ret = drm_connector_attach_encoder(connector, encoder);
if (ret)
return ERR_PTR(ret);
Because the connector was never registered, the link is never released. When
drm_connector_cleanup() runs, it might hit WARN_ON(b->link) and free the
structure without dropping the reference.
> diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
> index 4ba3a5deef9a6..6311ca726b45f 100644
> --- a/include/drm/drm_bridge.h
> +++ b/include/drm/drm_bridge.h
[ ... ]
> @@ -1586,6 +1586,7 @@ void drm_bridge_hpd_notify(struct drm_bridge *bridge,
>
> #ifdef CONFIG_DRM_PANEL_BRIDGE
> bool drm_bridge_is_panel(const struct drm_bridge *bridge);
> +struct drm_panel *drm_panel_bridge_to_panel(struct drm_bridge *bridge);
[Severity: Low]
Will this cause a build failure when CONFIG_DRM_PANEL_BRIDGE is disabled?
The function declaration lacks a static inline fallback when the config is
disabled, which might cause an implicit function declaration error when called
unconditionally in drm_bridge_connector_init().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260624165751.2014759-1-mario.limonciello@amd.com?part=9
next prev parent reply other threads:[~2026-06-24 17:13 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-24 16:57 [PATCH v6 00/10] Add support for a DRM backlight capability Mario Limonciello
2026-06-24 16:57 ` [PATCH v6 01/10] Revert "backlight: Remove notifier" Mario Limonciello
2026-06-24 17:10 ` sashiko-bot
2026-06-24 16:57 ` [PATCH v6 02/10] backlight: add kernel-internal backlight API Mario Limonciello
2026-06-24 17:11 ` sashiko-bot
2026-06-24 16:57 ` [PATCH v6 03/10] drm: link connectors to backlight devices Mario Limonciello
2026-06-24 17:10 ` sashiko-bot
2026-06-24 16:57 ` [PATCH v6 04/10] DRM: Add support for client indicating support for luminance Mario Limonciello
2026-06-24 17:12 ` sashiko-bot
2026-06-24 16:57 ` [PATCH v6 05/10] drm/amd/display: Pass up errors reading actual brightness Mario Limonciello
2026-06-24 16:57 ` [PATCH v6 06/10] drm/amd/display: Allow backlight registration to fail Mario Limonciello
2026-06-24 17:20 ` sashiko-bot
2026-06-24 16:57 ` [PATCH v6 07/10] drm/amd/display: use drm backlight Mario Limonciello
2026-06-24 17:19 ` sashiko-bot
2026-06-24 16:57 ` [PATCH v6 08/10] drm/amd/display: Drop brightness caching in amdgpu_dm Mario Limonciello
2026-06-24 17:16 ` sashiko-bot
2026-06-24 16:57 ` [PATCH v6 09/10] drm/bridge: auto-link panel backlight in bridge connector Mario Limonciello
2026-06-24 17:13 ` sashiko-bot [this message]
2026-06-24 16:57 ` [PATCH v6 10/10] drm/i915/display: use drm backlight Mario Limonciello
2026-06-24 17:19 ` sashiko-bot
2026-06-24 18:12 ` ✗ Fi.CI.BUILD: failure for Add support for a DRM backlight capability 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=20260624171306.7289C1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@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 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.