Linux USB
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Neil Armstrong" <neil.armstrong@linaro.org>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH 2/2] usb: typec: tcpm: unregister stale partner sink capabilities
Date: Fri, 20 Nov 2026 10:03:55 +0000	[thread overview]
Message-ID: <sashiko-outbox-224904@kernel.org> (raw)
In-Reply-To: <20261120-topic-tcpm-core-fixes-v1-2-c753d1d286bb@linaro.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] usb: typec: tcpm: unregister after register in
  tcpm_register_sink_caps()
--

commit bce11ccecca861664b61850ba73a6eebf8702e1e
Author: Neil Armstrong <neil.armstrong@linaro.org>

usb: typec: tcpm: unregister stale partner sink capabilities

This commit unregisters existing partner sink capabilities in
tcpm_register_sink_caps() when new Sink_Capabilities are received.

> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 1d007e59a2bf9..c5a4c0b6da16f 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm.c
> @@ -3563,6 +3563,8 @@ static int tcpm_register_sink_caps(struct tcpm_port *port)
>  	if (IS_ERR(cap))
>  		return PTR_ERR(cap);
>  
> +	if (port->partner_sink_caps)
> +		usb_power_delivery_unregister_capabilities(port->partner_sink_caps);
>  	port->partner_sink_caps = cap;
>  
>  	return 0;

[Severity: High]
Should port->partner_sink_caps be unregistered and cleared to NULL before
calling usb_power_delivery_register_capabilities(), as in
tcpm_register_source_caps()?

Because the old sink-capabilities child device is still registered under
port->partner_pd when usb_power_delivery_register_capabilities() runs,
device_register() fails with -EEXIST and tcpm_register_sink_caps() returns
early at IS_ERR(cap) before reaching the unregistration.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261120-topic-tcpm-core-fixes-v1-0-c753d1d286bb@linaro.org?part=2

  reply	other threads:[~2026-11-20 10:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  9:56 [PATCH 0/2] usb: tcpm: partner sink capabilities and altmodes leak fixes Neil Armstrong
2026-11-20  9:56 ` [PATCH 1/2] usb: typec: tcpm: unregister partner altmodes before re-discovery Neil Armstrong
2026-11-20 10:14   ` sashiko-bot
2026-11-20  9:56 ` [PATCH 2/2] usb: typec: tcpm: unregister stale partner sink capabilities Neil Armstrong
2026-11-20 10:03   ` sashiko-bot [this message]
2026-11-20 10:12     ` 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=sashiko-outbox-224904@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox