From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Badhri Jagan Sridharan <badhri@google.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Guenter Roeck <groeck@chromium.org>,
Igor Paunovic <royalnet026@gmail.com>,
linux-usb@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2 2/3] usb: typec: tcpm: unregister stale partner sink capabilities
Date: Mon, 30 Nov 2026 13:19:09 +0100 [thread overview]
Message-ID: <aw1pvZJnzDf48qIU@black.igk.intel.com> (raw)
In-Reply-To: <20261125-topic-tcpm-core-fixes-v2-2-aede2a3471f4@linaro.org>
On Wed, Nov 25, 2026 at 11:40:18AM +0100, Neil Armstrong wrote:
> tcpm_register_sink_caps() registers a new "sink-capabilities" device
> under the partner USB PD object every time a Sink_Capabilities message
> is received, but the previously registered one is only removed on
> detach.
>
> sink_cap_done is cleared on Hard Reset, so the sink capabilities are
> queried and registered again on the same partner: registering a second
> device with the same name under the same parent fails, and the stale
> capabilities stay exposed in sysfs.
>
> Unregister the previous capabilities before registering the new ones.
>
> Cc: stable@vger.kernel.org
> Fixes: 8203d26905ee ("usb: typec: tcpm: Register USB Power Delivery Capabilities")
> Assisted-by: LLM
> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/tcpm/tcpm.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 20e18bca649e..d0abe8100742 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -3559,6 +3559,11 @@ static int tcpm_register_sink_caps(struct tcpm_port *port)
> struct usb_power_delivery_capabilities_desc caps = { };
> struct usb_power_delivery_capabilities *cap;
>
> + if (port->partner_sink_caps) {
> + usb_power_delivery_unregister_capabilities(port->partner_sink_caps);
> + port->partner_sink_caps = NULL;
> + }
> +
> if (!port->partner_pd)
> port->partner_pd = usb_power_delivery_register(NULL, &desc);
> if (IS_ERR(port->partner_pd))
>
> --
> 2.34.1
>
--
heikki
next prev parent reply other threads:[~2026-11-30 12:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 10:40 [PATCH v2 0/3] usb: tcpm: partner sink capabilities and altmodes leak fixes Neil Armstrong
2026-11-25 10:40 ` [PATCH v2 1/3] usb: typec: tcpm: unregister partner altmodes before re-discovery Neil Armstrong
2026-11-25 10:40 ` [PATCH v2 2/3] usb: typec: tcpm: unregister stale partner sink capabilities Neil Armstrong
2026-11-30 12:19 ` Heikki Krogerus [this message]
2026-11-25 10:40 ` [PATCH v2 3/3] usb: typec: tcpm: destroy worker after reset_port() in unregister_port() Neil Armstrong
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=aw1pvZJnzDf48qIU@black.igk.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=badhri@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=groeck@chromium.org \
--cc=linux-usb@vger.kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=royalnet026@gmail.com \
--cc=stable@vger.kernel.org \
/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