dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alex Kazinsky" <a.kazinsky@ideco.ru>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/5] drm/connector: Check DP subconnector property before attaching it
Date: Fri, 27 Nov 2026 08:40:24 +0000	[thread overview]
Message-ID: <sashiko-outbox-236891@kernel.org> (raw)
In-Reply-To: <20261126081602.2901498-2-a.kazinsky@ideco.ru>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/connector: NULL deref in
  drm_dp_set_subconnector_property() on alloc fail
--

commit 8421b6289fec4b66a03cb7c78bad44b087056f4f
Author: Alex Kazinsky <a.kazinsky@ideco.ru>

drm/connector: Check DP subconnector property before attaching it

This commit checks that mode_config->dp_subconnector_property is non-NULL
before passing it to drm_object_attach_property() in
drm_connector_attach_dp_subconnector_property().

> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 893716a9e4895..41cbd76e0b1cc 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -2106,9 +2106,10 @@ void drm_connector_attach_dp_subconnector_property(struct drm_connector *connect
>  				drm_dp_subconnector_enum_list,
>  				ARRAY_SIZE(drm_dp_subconnector_enum_list));
>  
> -	drm_object_attach_property(&connector->base,
> -				   mode_config->dp_subconnector_property,
> -				   DRM_MODE_SUBCONNECTOR_Unknown);
> +	if (mode_config->dp_subconnector_property)
> +		drm_object_attach_property(&connector->base,
> +					   mode_config->dp_subconnector_property,
> +					   DRM_MODE_SUBCONNECTOR_Unknown);
>  }
>  EXPORT_SYMBOL(drm_connector_attach_dp_subconnector_property);

[Severity: Medium]
If drm_property_create_enum() fails here, does skipping
drm_object_attach_property() just defer the NULL pointer dereference to
connector detection?

DP connector initialization still succeeds with
mode_config.dp_subconnector_property left as NULL.  On the next detect or
hotplug event, drm_dp_set_subconnector_property() (and amdgpu's
update_subconnector_property()) passes that NULL pointer directly to
drm_object_property_set_value(), which unconditionally dereferences
property->dev:

drivers/gpu/drm/display/drm_dp_helper.c:drm_dp_set_subconnector_property() {
	if (status == connector_status_connected)
		subconnector = drm_dp_subconnector_type(dpcd, port_cap);
	drm_object_property_set_value(&connector->base,
			connector->dev->mode_config.dp_subconnector_property,
			subconnector);
}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126081602.2901498-1-a.kazinsky@ideco.ru?part=1

  reply	other threads:[~2026-11-27  8:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  8:15 [PATCH 0/5] drm/connector: Handle connector property allocation failures Alex Kazinsky
2026-11-26  8:15 ` [PATCH 1/5] drm/connector: Check DP subconnector property before attaching it Alex Kazinsky
2026-11-27  8:40   ` sashiko-bot [this message]
2026-11-26  8:15 ` [PATCH 2/5] drm/connector: Handle DVI-I property allocation failures Alex Kazinsky
2026-11-26  8:15 ` [PATCH 3/5] drm/connector: Propagate content type property creation errors Alex Kazinsky
2026-11-26 15:46   ` Albert Esteve
2026-11-27  8:38   ` sashiko-bot
2026-11-26  8:15 ` [PATCH 4/5] drm/connector: Handle scaling mode property allocation failures Alex Kazinsky
2026-11-27  8:39   ` sashiko-bot
2026-11-29  3:53   ` Mario Limonciello
2026-11-26  8:16 ` [PATCH 5/5] drm/connector: Handle privacy-screen " Alex Kazinsky

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-236891@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=a.kazinsky@ideco.ru \
    --cc=dri-devel@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox