Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Xiao Lu" <xiaolu.xie@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 2/2] drm/dp_mst: Track allocated_pbn from ALLOCATE_PAYLOAD down-reply
Date: Tue, 22 Sep 2026 09:41:17 +0000	[thread overview]
Message-ID: <20260922094118.6DBE81F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260922092647.2263962-3-xiaolu.xie@intel.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] drm/dp_mst: Data race and logical flaw in allocated_pbn causes spurious -ENOSPC
- [High] drm/dp_mst: Unvalidated allocated_pbn from device causes permanent DoS
--

commit 4a7c9a56c428ab20bf4027cd5c4e8a720688111a
Author: Xiao Lu <xiaolu.xie@intel.com>

drm/dp_mst: Track allocated_pbn from ALLOCATE_PAYLOAD down-reply

This commit stores the allocated_pbn returned by the ALLOCATE_PAYLOAD
down-reply sideband message. It uses the larger of requested PBN and
allocated PBN for the MST bandwidth limit checks, carrying the value across
dependent atomic commits.

> diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c
> index 7ce9e212770ad..b0e4cf8458eda 100644
> --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c
> @@ -3166,10 +3167,14 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
>  	 */
>  	ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
>  	if (ret > 0) {
> -		if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
> +		if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK) {
>  			ret = -EINVAL;
> -		else
> +		} else {
> +			if (payload)
> +				payload->allocated_pbn =
> +					txmsg->reply.u.allocate_payload.allocated_pbn;

[Severity: High]
Is it safe to write to the active atomic state payload from an asynchronous
worker here without modeset locks?

If drm_dp_add_payload_part2() locklessly mutates allocated_pbn concurrently
with drm_dp_mst_duplicate_state(), could this result in a data race?

[Severity: High]
Is this untrusted 16-bit value from the branch device saved into the payload
state here without bounds checking?

If a malicious or malfunctioning branch device replies to the
ALLOCATE_PAYLOAD message with a spoofed allocated_pbn value (e.g., 65535),
could it be stored directly without validation?

>  			ret = 0;
> +		}
>  	}
>  	kfree(txmsg);
>  fail_put:
[ ... ]
> @@ -4670,6 +4678,7 @@ void drm_dp_mst_atomic_wait_for_dependencies(struct drm_atomic_commit *state)
>  			new_payload = drm_atomic_get_mst_payload_state(new_mst_state,
>  								       old_payload->port);
>  			new_payload->vc_start_slot = old_payload->vc_start_slot;
> +			new_payload->allocated_pbn = old_payload->allocated_pbn;

[Severity: High]
Could this unconditional restore overwrite the 0 set by
drm_dp_atomic_find_time_slots() during the atomic check phase?

If it does, could it inflate the perceived bandwidth for concurrent checks?

>  			new_payload->payload_allocation_status =
>  							old_payload->payload_allocation_status;
>  		}
[ ... ]
> @@ -5352,7 +5361,7 @@ drm_dp_mst_atomic_check_port_bw_limit(struct drm_dp_mst_port *port,
>  			return -EINVAL;
>  		}
>  
> -		pbn_used = payload->pbn;
> +		pbn_used = max(payload->pbn, payload->allocated_pbn);

[Severity: High]
Does evaluating this max() with a potentially stale or artificially inflated
value concurrently produce incorrect bandwidth checks?

If so, could it cause spurious -ENOSPC failures in bandwidth validation,
causing display configurations to fail randomly?

Also, if a maliciously huge value was evaluated here, could it force
pbn_used > port->full_pbn, failing the check?

Since the topology check iterates over all payloads, could this permanently
prevent any future display configurations on this topology?

>  	} else {
>  		pbn_used = drm_dp_mst_atomic_check_mstb_bw_limit(port->mstb,

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260922092647.2263962-1-xiaolu.xie@intel.com?part=2

  reply	other threads:[~2026-09-22  9:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22  9:26 [PATCH v2 0/2] drm/dp/mst: fix MST payload PBN accounting Xiao Lu
2026-09-22  9:26 ` [PATCH v2 1/2] drm/i915/dp: fix PBN in ALLOCATE_PAYLOAD request to use actual video bandwidth Xiao Lu
2026-09-22  9:35   ` sashiko-bot
2026-09-22  9:26 ` [PATCH v2 2/2] drm/dp_mst: Track allocated_pbn from ALLOCATE_PAYLOAD down-reply Xiao Lu
2026-09-22  9:41   ` sashiko-bot [this message]
2026-09-22  9:35 ` [PATCH v2 0/2] drm/dp/mst: fix MST payload PBN accounting Jani Nikula
2026-09-22 12:30 ` ✓ i915.CI.BAT: success for " Patchwork
2026-09-22 23:22 ` ✗ i915.CI.Full: failure " Patchwork
2026-09-24  9:43 ` [PATCH v3 0/2] drm/i915/dp: Fix MST " Xiao Lu
2026-09-24  9:43   ` [PATCH v3 1/2] drm/i915/dp: fix PBN in ALLOCATE_PAYLOAD request to use actual video bandwidth Xiao Lu
2026-09-24  9:51     ` sashiko-bot
2026-09-24  9:43   ` [PATCH v3 2/2] drm/dp_mst: Track allocated_pbn from ALLOCATE_PAYLOAD down-reply Xiao Lu
2026-09-24  9:57     ` sashiko-bot

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=20260922094118.6DBE81F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=xiaolu.xie@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox