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 6F2B8350D46; Tue, 6 Jan 2026 17:22:15 +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=1767720135; cv=none; b=groMyP0PVOzcmPr/Ri/KHTTPRzZothlF73FuvOTwtzixIL4eMi6DjsPy0IzncSgGOsTVrbUlTS1DCZ56qBR4aKeVhGps8g1/lOTaOxNqAnTGo5eYnkhaY74i79a7wa6VI++Mc2ICn4pFzqWFBWz9dO27hSxdFv/BybAX1DpEGlY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767720135; c=relaxed/simple; bh=m9GHbLSEtaN7y/EOoc7W1fbjFP2PUM0BFf+8hznNlcc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g3LVgZrhjT9DmQvZCFvbs8xQfs83OSIXovO+sHmiCGN6mbypEbijF1h9XBKL9uyN2q7Gy7LXenA0bAXuO9OkR7KY9WY57vKBde+d+MljTIPXqeqgP2/M55Qt/hA9Z3v+LM9EOTAoy6B11Xd+ITdJP03UKJeZ2PvkTe+qswNJDcs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=A0h+Y5+S; 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="A0h+Y5+S" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C975FC116C6; Tue, 6 Jan 2026 17:22:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1767720135; bh=m9GHbLSEtaN7y/EOoc7W1fbjFP2PUM0BFf+8hznNlcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A0h+Y5+SodIyZuPtwtbr+DXj4MDhcZYrExI8B2NVjv0KLbXXl8PAKoDQ0XKCGndwR WzKdp8INBLfJC51sHTTafPYaoFD57xptezgMWCWYQIy+FedSynklLNL/541A3+tLRt 9YuOtBxMLg4W5VdWykCTTNJtDJGHW/+iom26p+zE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mark Pearson , Heikki Krogerus , Sasha Levin Subject: [PATCH 6.12 137/567] usb: typec: ucsi: Handle incorrect num_connectors capability Date: Tue, 6 Jan 2026 17:58:39 +0100 Message-ID: <20260106170456.394323064@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260106170451.332875001@linuxfoundation.org> References: <20260106170451.332875001@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: Mark Pearson [ Upstream commit 30cd2cb1abf4c4acdb1ddb468c946f68939819fb ] The UCSI spec states that the num_connectors field is 7 bits, and the 8th bit is reserved and should be set to zero. Some buggy FW has been known to set this bit, and it can lead to a system not booting. Flag that the FW is not behaving correctly, and auto-fix the value so that the system boots correctly. Found on Lenovo P1 G8 during Linux enablement program. The FW will be fixed, but seemed worth addressing in case it hit platforms that aren't officially Linux supported. Signed-off-by: Mark Pearson Reviewed-by: Heikki Krogerus Link: https://lore.kernel.org/r/20250821185319.2585023-1-mpearson-lenovo@squebb.ca Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/typec/ucsi/ucsi.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index 896e6bc1b5e2..9a0fb6a79b21 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -1772,6 +1772,12 @@ static int ucsi_init(struct ucsi *ucsi) ret = -ENODEV; goto err_reset; } + /* Check if reserved bit set. This is out of spec but happens in buggy FW */ + if (ucsi->cap.num_connectors & 0x80) { + dev_warn(ucsi->dev, "UCSI: Invalid num_connectors %d. Likely buggy FW\n", + ucsi->cap.num_connectors); + ucsi->cap.num_connectors &= 0x7f; // clear bit and carry on + } /* Allocate the connectors. Released in ucsi_unregister() */ connector = kcalloc(ucsi->cap.num_connectors + 1, sizeof(*connector), GFP_KERNEL); -- 2.51.0