From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60CAA1A681E; Fri, 7 Aug 2026 15:16:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786115803; cv=none; b=J+BpLAvN4svjdImS38QnrWlXtSHpUO+g5/ekVXvjokzUHJSGstjIHKspO+VEF21+BaHfO6gTQ9NNGIV5SyoPSZ5aFh46S15zwqO2ntQGkko6/yBRDd1bIfK3kZnmeD4Ah1VWF/LhXP0Bxl2LNEJ7U6IZT6M93Wej1prArRXLiro= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786115803; c=relaxed/simple; bh=LcolZhC29vHIUO2yu1/RWEIXF3nYBZLLq9zkLA8ixeM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J9t3fceOVVWQRgPgYPN9squVx9lmkq9YyEFMZmVeT32MhasgqwFdKeeLyg8ZLPS+1C1P9sxm43JebHSAs/yFNS9SnSWTQSQAfQPD0sYPB0DmmxRn+iO4efzJT++ihbHqJ2WKCtLeUtvEi93Ay/hrA5lhXAxdrlr+VKdtuc00E+U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=DdH4ieRt; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="DdH4ieRt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B99BD1F000E9; Fri, 7 Aug 2026 15:16:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786115798; bh=lHGHVGtreAWAf3IAqeGT6iIk229dofwpZARkeXBWvJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=DdH4ieRt8BSKQXBCEiWrkYyN7nn1F1Q9m5zrr5qNJKj0Xcv66OQeaeB0TLvN9jH3Z FfK8FIWuA+avJKky8Ay0YT46ytuEd+qSQzR4pT02I6dzCbl9gUd/KUR50jDkLloJ68 RDTXTZPvSyYZVsi47W0X3a1K0EN4PO2L9nnC3anU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Borah, Chaitanya Kumar" , Andrei Kuchynski , Heikki Krogerus Subject: [PATCH 6.18 394/396] usb: typec: ucsi: Correct teardown ordering in ucsi_init() error path Date: Fri, 7 Aug 2026 16:39:14 +0200 Message-ID: <20260807143432.772895054@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260807143424.272339768@linuxfoundation.org> References: <20260807143424.272339768@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andrei Kuchynski commit fb0bf289f5d529336ef490c8273e88a8a8b29f69 upstream. 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. Cc: stable@vger.kernel.org Fixes: 7aa7d4bf9d3f ("usb: typec: ucsi: Fix race condition and ordering in port unregistration") Reported-by: "Borah, Chaitanya Kumar" Closes: https://lore.kernel.org/all/22064276-6c56-411a-9f20-6917ceeb865f@intel.com/ Signed-off-by: Andrei Kuchynski Tested-by: Chaitanya Kumar Borah Reviewed-by: Heikki Krogerus Link: https://patch.msgid.link/20260717104614.325250-1-akuchynski@chromium.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/ucsi/ucsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -2050,11 +2050,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));