Linux USB
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Konrad Dybcio <konradybcio@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Benson Leung <bleung@chromium.org>,
	Andrei Kuchynski <akuchynski@chromium.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
	usb4-upstream@oss.qualcomm.com,
	Raghavendra Thoorpu <rthoorpu@qti.qualcomm.com>
Subject: Re: [PATCH] usb: typec: ucsi: Unregister lockdep key only after last lock use
Date: Tue, 21 Jul 2026 13:31:18 +0300	[thread overview]
Message-ID: <al9KdsRvLhq3sE23@kuha> (raw)
In-Reply-To: <20260720-topic-ucsi_lockdep-v1-1-6c1b5f9d1f3e@oss.qualcomm.com>

On Mon, Jul 20, 2026 at 04:24:27PM +0200, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> 
> ucsi_unregister_port() starts off with taking con->lock. Fix the
> ucsi_init() teardown path to avoid unregistering the lockdep key
> associated with it right before its use.

There's already a fix for this one:
https://lore.kernel.org/linux-usb/20260717104614.325250-1-akuchynski@chromium.org/

> Fixes: 7aa7d4bf9d3f ("usb: typec: ucsi: Fix race condition and ordering in port unregistration")
> Assisted-by: Codex:GPT-5.5
> Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
> ---
> To: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> To: Andrei Kuchynski <akuchynski@chromium.org>
> To: Benson Leung <bleung@chromium.org>
> Cc: linux-usb@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: usb4-upstream@oss.qualcomm.com
> Cc: Raghavendra Thoorpu <rthoorpu@qti.qualcomm.com>
> ---
>  drivers/usb/typec/ucsi/ucsi.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> index d221ca9bc88e..67c75e6bdfae 100644
> --- a/drivers/usb/typec/ucsi/ucsi.c
> +++ b/drivers/usb/typec/ucsi/ucsi.c
> @@ -2142,11 +2142,12 @@ 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));

Thanks,

-- 
heikki

      reply	other threads:[~2026-07-21 10:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20 14:24 [PATCH] usb: typec: ucsi: Unregister lockdep key only after last lock use Konrad Dybcio
2026-07-21 10:31 ` Heikki Krogerus [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=al9KdsRvLhq3sE23@kuha \
    --to=heikki.krogerus@linux.intel.com \
    --cc=akuchynski@chromium.org \
    --cc=bleung@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=rthoorpu@qti.qualcomm.com \
    --cc=usb4-upstream@oss.qualcomm.com \
    /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