From: sashiko-bot@kernel.org
To: "Jens Glathe" <jens.glathe@oldschoolsolutions.biz>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 3/5] usb: typec: mux: ps883x: refactor DP altmode handling and support TYPEC_DP_STATE_F
Date: Sat, 18 Jul 2026 17:29:16 +0000 [thread overview]
Message-ID: <20260718172916.9EF9C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260718-ps883x-disable-usb4-v1-3-cec86d0b909e@oldschoolsolutions.biz>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Dereferencing NULL pointer during Thunderbolt Alt Mode teardown.
- [High] Failure to tear down DisplayPort Alt Mode correctly during SAFE state transition.
--
--- Patch [3]: [PATCH 3/5] usb: typec: mux: ps883x: refactor DP altmode handling and support TYPEC_DP_STATE_F ---
commit 1182bfe184aec8b5b6e514d7c1a3d153c73073da
Author: Jens Glathe <jens.glathe@oldschoolsolutions.biz>
usb: typec: mux: ps883x: refactor DP altmode handling and support TYPEC_DP_STATE_F
This commit refactors DisplayPort altmode handling into a helper function.
It also adds support for the legacy TYPEC_DP_STATE_F mode to ensure DP
altmode works correctly on certain docks during Type-C fallback mode.
> diff --git a/drivers/usb/typec/mux/ps883x.c b/drivers/usb/typec/mux/ps883x.c
> index 3fa26ce01a9c9..3533d4f363286 100644
> --- a/drivers/usb/typec/mux/ps883x.c
> +++ b/drivers/usb/typec/mux/ps883x.c
[ ... ]
> @@ -188,6 +188,25 @@ static int ps883x_configure(struct ps883x_retimer *retimer, int cfg0,
> return 0;
> }
>
> +static void ps883x_apply_dp_altmode(int *cfg0, int *cfg1, int dp_state)
> +{
> + *cfg1 |= CONN_STATUS_1_DP_CONNECTED | CONN_STATUS_1_DP_HPD_LEVEL;
> +
> + switch (dp_state) {
[Severity: High]
This is a pre-existing issue, but does this correctly handle tearing down
the DisplayPort Alt Mode?
When the system requests TYPEC_STATE_SAFE (mode 0) to tear down the alt
mode, dp_state will be 0. It seems the CONN_STATUS_1_DP_CONNECTED and
CONN_STATUS_1_DP_HPD_LEVEL bits are unconditionally applied here, and the
switch statement hits the default empty case. Because state->alt is still
present, the retimer remains inappropriately configured for DisplayPort
instead of resetting.
> + case TYPEC_DP_STATE_D:
> + case TYPEC_DP_STATE_F:
> + *cfg0 |= CONN_STATUS_0_USB_3_1_CONNECTED;
> + fallthrough;
> + case TYPEC_DP_STATE_C:
> + case TYPEC_DP_STATE_E:
> + *cfg1 |= CONN_STATUS_1_DP_SINK_REQUESTED |
> + CONN_STATUS_1_DP_PIN_ASSIGNMENT_C_D;
> + break;
> + default:
> + break;
> + }
> +}
> +
> static int ps883x_set(struct ps883x_retimer *retimer, struct typec_retimer_state *state)
> {
> struct typec_thunderbolt_data *tb_data;
[ ... ]
> case USB_TYPEC_TBT_SID:
> tb_data = state->data;
> -
> /* Unconditional */
> cfg2 |= CONN_STATUS_2_TBT_CONNECTED;
>
[Severity: High]
This isn't a bug introduced by this patch, but will this cause a NULL
pointer dereference when a Thunderbolt device is unplugged?
During an active Thunderbolt device unplug, the Type-C bus core calls
typec_altmode_remove() which sets the state to TYPEC_STATE_SAFE and passes
NULL for state->data. Here in ps883x_set(), tb_data is assigned to
state->data and then unconditionally dereferenced just below this block for
tb_data->cable_mode, which seems like it would cause a kernel panic during
teardown.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260718-ps883x-disable-usb4-v1-0-cec86d0b909e@oldschoolsolutions.biz?part=3
next prev parent reply other threads:[~2026-07-18 17:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-18 17:06 [PATCH 0/5] usb: typec: ps883x: fixes for older Thunderbolt 4 / USB4 docks Jens Glathe via B4 Relay
2026-07-18 17:06 ` [PATCH 1/5] dt-bindings: usb: parade,ps8830: Add parade,disable-usb4 property Jens Glathe via B4 Relay
2026-07-18 17:11 ` sashiko-bot
2026-07-18 17:06 ` [PATCH 2/5] usb: typec: ps883x: Return -EOPNOTSUPP for USB4 when parade,disable-usb4 is set Jens Glathe via B4 Relay
2026-07-18 17:14 ` sashiko-bot
2026-07-18 17:06 ` [PATCH 3/5] usb: typec: mux: ps883x: refactor DP altmode handling and support TYPEC_DP_STATE_F Jens Glathe via B4 Relay
2026-07-18 17:29 ` sashiko-bot [this message]
2026-07-18 17:06 ` [PATCH 4/5] usb: typec: mux: ps883x: add a delay after writing config regs Jens Glathe via B4 Relay
2026-07-18 17:06 ` [PATCH 5/5] arm64: dts: qcom: x1: disable ps883x USB4 capability Jens Glathe via B4 Relay
2026-07-18 17:22 ` 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=20260718172916.9EF9C1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jens.glathe@oldschoolsolutions.biz \
--cc=robh@kernel.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