From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DB895175A80; Mon, 23 Mar 2026 14:17:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774275456; cv=none; b=WYQkLSfy4VUiexq1A4OmCf+Zaj9/EKPenH/Zqi5yhrM9YR/QP7HIrMP5M8+x1e01p8nCCjNvYlnnn2nErtfwr3VsvGlKJqtZH1k49Xfgleb7C1JoFBtEuQ0PCObvb8o8fSovNrCgEJ2z/uTiJBNTdC0j55sXex20ogfNIM8ewhA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774275456; c=relaxed/simple; bh=D1dl4trwH3apMoYVG93IdO/1/YRduwbWLvGQlB4Y/Ag=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WOub2kwsxc6Kp11KlIHypKR3qlvhhgosudOBwjKL2osJeN424XBz7jLfcH6G9f3AR6BnL6G9RdUDFPuwTOInPSouuGhszmi1VSBq6ugfkUxJD71wcs/o6g0RjhsgLSJii+e21Pbt/+omNJX+O0NR04lajyI/IYbYVlzYEmBtQK0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=uWKVRCoQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="uWKVRCoQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B5F8C4CEF7; Mon, 23 Mar 2026 14:17:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774275456; bh=D1dl4trwH3apMoYVG93IdO/1/YRduwbWLvGQlB4Y/Ag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uWKVRCoQtDilOXkJxyCm+YhvyESGG1hopB59rEdXMz2eGHt8rnXmuMqT9GCcfZrZm 2pmvEnajQdAeLN6j6/KEmJg+ssgK2iT0PRVGKF629/EeSsr+t0ox8J7LFyueqbxcZA O1jqvR5Ab7WkpPFIZz7b/ivaVq9cNaYnBFtozNxk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Xu Yang , Arnaud Ferraris , Heikki Krogerus Subject: [PATCH 6.12 108/460] usb: roles: get usb role switch from parent only for usb-b-connector Date: Mon, 23 Mar 2026 14:41:44 +0100 Message-ID: <20260323134529.297726265@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134526.647552166@linuxfoundation.org> References: <20260323134526.647552166@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Xu Yang commit 8345b1539faa49fcf9c9439c3cbd97dac6eca171 upstream. usb_role_switch_is_parent() was walking up to the parent node and checking for the "usb-role-switch" property regardless of the type of the passed fwnode. This could cause unrelated device nodes to be probed as potential role switch parent, leading to spurious matches and "-EPROBE_DEFER" being returned infinitely. Till now only Type-B connector node will have a parent node which may present "usb-role-switch" property and register the role switch device. For Type-C connector node, its parent node will always be a Type-C chip device which will never register the role switch device. However, it may still present a non-boolean "usb-role-switch = <&usb_controller>" property for historical compatibility. So restrict the helper to only operate on Type-B connector when attempting to get the role switch from parent node. Fixes: 6fadd72943b8 ("usb: roles: get usb-role-switch from parent") Cc: stable Signed-off-by: Xu Yang Tested-by: Arnaud Ferraris Reviewed-by: Heikki Krogerus Link: https://patch.msgid.link/20260309074313.2809867-3-xu.yang_2@nxp.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/roles/class.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/drivers/usb/roles/class.c +++ b/drivers/usb/roles/class.c @@ -139,9 +139,14 @@ static void *usb_role_switch_match(const static struct usb_role_switch * usb_role_switch_is_parent(struct fwnode_handle *fwnode) { - struct fwnode_handle *parent = fwnode_get_parent(fwnode); + struct fwnode_handle *parent; struct device *dev; + if (!fwnode_device_is_compatible(fwnode, "usb-b-connector")) + return NULL; + + parent = fwnode_get_parent(fwnode); + if (!fwnode_property_present(parent, "usb-role-switch")) { fwnode_handle_put(parent); return NULL;