From: sashiko-bot@kernel.org
To: "Neil Armstrong" <neil.armstrong@linaro.org>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH v3 3/3] usb: typec: qcom-pmic-typec: detach the port on shutdown
Date: Tue, 01 Dec 2026 09:05:53 +0000 [thread overview]
Message-ID: <sashiko-outbox-242908@kernel.org> (raw)
In-Reply-To: <20261201-topic-tcpm-qcom-fixes-v3-3-8dca0188915e@linaro.org>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] usb: typec: qcom: NULL deref in tcpm_vbus_change() on shutdown
with VBUS on
- [Medium] usb: typec: qcom: missing port_disable() on
qcom_pmic_typec_probe() error path
--
commit 4cd6e3b2d4452793cc04ed00c87bc010696a9646
Author: Neil Armstrong <neil.armstrong@linaro.org>
usb: typec: qcom-pmic-typec: detach the port on shutdown
This commit adds a port_disable callback to switch the Type-C block through
sink-only mode to disabled, and invokes it on probe, remove, and a new
shutdown callback.
> diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
> index 58d1e6aae637d..be7508936796e 100644
> --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
> +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
> @@ -132,6 +132,17 @@ static void qcom_pmic_typec_remove(struct platform_device *pdev)
> tcpm->port_stop(tcpm);
> tcpm_unregister_port(tcpm->tcpm_port);
> fwnode_handle_put(tcpm->tcpc.fwnode);
> + tcpm->port_disable(tcpm);
> +}
[Severity: Medium]
Should the error unwind path in qcom_pmic_typec_probe() also call
tcpm->port_disable(tcpm)?
tcpm_register_port() and qcom_pmic_typec_port_start() re-enable
TYPEC_MODE_CFG_REG after qcom_pmic_typec_port_probe() disables it, so a later
failure in probe leaves the Type-C block active presenting Rp or Rd with no
driver bound.
> +
> +static void qcom_pmic_typec_shutdown(struct platform_device *pdev)
> +{
> + struct pmic_typec *tcpm = platform_get_drvdata(pdev);
> +
> + tcpm->pdphy_stop(tcpm);
> + tcpm->port_stop(tcpm);
> + tcpm_unregister_port(tcpm->tcpm_port);
> + tcpm->port_disable(tcpm);
> +}
[Severity: High]
Can calling tcpm_unregister_port() on shutdown while sourcing VBUS to a sink
partner trigger a NULL pointer dereference in tcpm_vbus_change()?
tcpm_unregister_port() destroys port->wq and sets it to NULL before calling
tcpm_reset_port():
drivers/usb/typec/tcpm/tcpm.c:tcpm_unregister_port() {
port->registered = false;
kthread_destroy_worker(port->wq);
port->wq = NULL;
...
tcpm_reset_port(port);
}
When VBUS is enabled, tcpm_reset_port() -> tcpm_init_vbus() calls
qcom_pmic_typec_port_set_vbus(tcpc, false, false), which calls
tcpm_vbus_change(tcpm->tcpm_port) and passes the NULL port->wq to
kthread_queue_work(), crashing before tcpm->port_disable(tcpm) is reached.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201-topic-tcpm-qcom-fixes-v3-0-8dca0188915e@linaro.org?part=3
next prev parent reply other threads:[~2026-12-01 9:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 8:50 [PATCH v3 0/3] usb: typec: qcom-pmic-typec: properly tear down port on remove and shutdown Neil Armstrong
2026-12-01 8:50 ` [PATCH v3 1/3] usb: typec: qcom-pmic-typec: pdphy: disable the PD PHY on stop Neil Armstrong
2026-12-01 8:50 ` [PATCH v3 2/3] usb: typec: qcom-pmic-typec: detach the port on probe Neil Armstrong
2026-12-01 8:50 ` [PATCH v3 3/3] usb: typec: qcom-pmic-typec: detach the port on shutdown Neil Armstrong
2026-12-01 9:05 ` sashiko-bot [this message]
2026-12-01 9:05 ` [PATCH v3 0/3] usb: typec: qcom-pmic-typec: properly tear down port on remove and shutdown 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=sashiko-outbox-242908@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=neil.armstrong@linaro.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 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.