From: Konrad Dybcio <konradybcio@kernel.org>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Benson Leung <bleung@chromium.org>,
Andrei Kuchynski <akuchynski@chromium.org>
Cc: 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: [PATCH] usb: typec: ucsi: Unregister lockdep key only after last lock use
Date: Mon, 20 Jul 2026 16:24:27 +0200 [thread overview]
Message-ID: <20260720-topic-ucsi_lockdep-v1-1-6c1b5f9d1f3e@oss.qualcomm.com> (raw)
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.
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));
---
base-commit: 0718283ab28bc3907e10b61a6b4be6fefa1cbb2f
change-id: 20260720-topic-ucsi_lockdep-b48ec8de8665
Best regards,
--
Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
next reply other threads:[~2026-07-20 14:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 14:24 Konrad Dybcio [this message]
2026-07-21 10:31 ` Heikki Krogerus
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=20260720-topic-ucsi_lockdep-v1-1-6c1b5f9d1f3e@oss.qualcomm.com \
--to=konradybcio@kernel.org \
--cc=akuchynski@chromium.org \
--cc=bleung@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=konrad.dybcio@oss.qualcomm.com \
--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
all inboxes | Powered by JetHome®