From: "Borah, Chaitanya Kumar" <chaitanya.kumar.borah@intel.com>
To: Andrei Kuchynski <akuchynski@chromium.org>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Jameson Thies <jthies@google.com>,
"Benson Leung" <bleung@chromium.org>, <linux-usb@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Pooja Katiyar <pooja.katiyar@intel.com>,
Abhishek Pandit-Subedi <abhishekpandit@chromium.org>,
Johan Hovold <johan@kernel.org>,
Hsin-Te Yuan <yuanhsinte@chromium.org>,
Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>,
Jack Pham <quic_jackp@quicinc.com>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
<stable@vger.kernel.org>
Subject: Re: [PATCH v2] usb: typec: ucsi: Correct teardown ordering in ucsi_init() error path
Date: Fri, 17 Jul 2026 17:27:02 +0530 [thread overview]
Message-ID: <2efef615-83ff-4172-a680-e02e999bfa8b@intel.com> (raw)
In-Reply-To: <20260717104614.325250-1-akuchynski@chromium.org>
On 7/17/2026 4:16 PM, Andrei Kuchynski wrote:
> The commit 7aa7d4bf9d3f ("usb: typec: ucsi: Fix race condition and
> ordering in port unregistration") consolidated port teardown into the
> ucsi_unregister_port() helper. However, it introduced an ordering problem
> in the ucsi_init() error path.
>
> Fix this by ensuring ucsi_unregister_port() is called before we unregister
> their corresponding lockdep keys.
>
Feel free to use.
Tested-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
> Cc: stable@vger.kernel.org
> Fixes: 7aa7d4bf9d3f ("usb: typec: ucsi: Fix race condition and ordering in port unregistration")
> Reported-by: "Borah, Chaitanya Kumar" <chaitanya.kumar.borah@intel.com>
> Closes: https://lore.kernel.org/all/22064276-6c56-411a-9f20-6917ceeb865f@intel.com/
> Signed-off-by: Andrei Kuchynski <akuchynski@chromium.org>
> ---
> Changes in v2:
> - Added Reported-by tag.
>
> drivers/usb/typec/ucsi/ucsi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> index 1ae4224d2dfc3..49f1c53721bbd 100644
> --- a/drivers/usb/typec/ucsi/ucsi.c
> +++ b/drivers/usb/typec/ucsi/ucsi.c
> @@ -2142,11 +2142,11 @@ static int ucsi_init(struct ucsi *ucsi)
> return 0;
>
> err_unregister:
> + for (con = connector; con->port; con++)
> + ucsi_unregister_port(con);
> for (i = 0; i < ucsi->cap.num_connectors; i++)
> lockdep_unregister_key(&connector[i].lock_key);
>
> - for (con = connector; con->port; con++)
> - ucsi_unregister_port(con);
> kfree(connector);
> err_reset:
> memset(&ucsi->cap, 0, sizeof(ucsi->cap));
prev parent reply other threads:[~2026-07-17 11:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 10:46 [PATCH v2] usb: typec: ucsi: Correct teardown ordering in ucsi_init() error path Andrei Kuchynski
2026-07-17 11:57 ` Borah, Chaitanya Kumar [this message]
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=2efef615-83ff-4172-a680-e02e999bfa8b@intel.com \
--to=chaitanya.kumar.borah@intel.com \
--cc=abhishekpandit@chromium.org \
--cc=akuchynski@chromium.org \
--cc=bleung@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=johan@kernel.org \
--cc=jthies@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=myrrhperiwinkle@qtmlabs.xyz \
--cc=pooja.katiyar@intel.com \
--cc=quic_jackp@quicinc.com \
--cc=senozhatsky@chromium.org \
--cc=stable@vger.kernel.org \
--cc=yuanhsinte@chromium.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