dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Arthur Liberman" <arthur_liberman@hotmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/3] drm/amd/display: fix NULL stream deref on MST DPMS-off
Date: Tue, 22 Sep 2026 16:09:39 +0000	[thread overview]
Message-ID: <20260922160940.497841F000FF@smtp.kernel.org> (raw)
In-Reply-To: <DB9PR03MB7388900446938D7712613C9A8A832@DB9PR03MB7388.eurprd03.prod.outlook.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] drm/amd/display: dead code in MST DPMS-off loop
--

commit 07293e89053ea9e3ce60dc0852be04a50a4ec01e
Author: Arthur Liberman <arthur_liberman@hotmail.com>

    drm/amd/display: fix NULL stream deref on MST DPMS-off

This commit adds a NULL check for streams in the MST DPMS-off loop in
link_set_all_streams_dpms_off_for_link() and adds stream NULL checks in
dc_stream_get_status().

> diff --git a/drivers/gpu/drm/amd/display/dc/link/link_dpms.c b/drivers/gpu/drm/amd/display/dc/link/link_dpms.c
> index 48b086d15ab0c..17cb831ce8c48 100644
> --- a/drivers/gpu/drm/amd/display/dc/link/link_dpms.c
> +++ b/drivers/gpu/drm/amd/display/dc/link/link_dpms.c
> @@ -177,6 +177,13 @@ void link_set_all_streams_dpms_off_for_link(struct dc_link *link)
>  		streams[i] = pipes[i]->stream;
>  
>  	for (i = 0; i < count; i++) {
> +		/* A full update can release current_state and NULL remaining
> +		 * pipe streams. MST daisy-chains have multiple streams on one
> +		 * link, so skip any that disappeared mid-loop.
> +		 */
> +		if (!streams[i])
> +			continue;
> +

[Severity: Low]
Does this check actually protect against mid-loop state changes?

The function link_get_master_pipes_with_dpms_on() guarantees that
pipes[i]->stream is non-NULL when populated, and these pointers are copied
into the local streams[] array before the loop.

Since streams[] is a local array and its elements are not updated inside this
loop, is it possible for streams[i] to become NULL during iteration? It appears
this check might be dead code that provides no runtime protection.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/DB9PR03MB73884B0D604BA858636247CF8A832@DB9PR03MB7388.eurprd03.prod.outlook.com?part=1

  parent reply	other threads:[~2026-09-22 16:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 15:51 [PATCH 0/3] drm/amd/display: fix NULL derefs on MST HPD and teardown Arthur Liberman
2026-09-22 15:53 ` [PATCH 1/3] drm/amd/display: fix NULL stream deref on MST DPMS-off Arthur Liberman
2026-09-22 15:53   ` [PATCH 2/3] drm/amd/display: skip destructive HPD verify on live links Arthur Liberman
2026-09-22 15:54     ` [PATCH 3/3] drm/amd/display: skip MST slot release if port is gone Arthur Liberman
2026-09-22 16:09   ` sashiko-bot [this message]
2026-09-22 15:58 ` [PATCH 0/3] drm/amd/display: fix NULL derefs on MST HPD and teardown Arthur Liberman

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=20260922160940.497841F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=arthur_liberman@hotmail.com \
    --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