From nobody Mon Jun 15 00:03:24 2026 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A600D26B2D2 for ; Tue, 7 Apr 2026 06:40:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775544036; cv=none; b=ewzbxRBSjDjKpibMatJ401hoRx9R7h7wHPZUbtyzBDDUwczzC/jrMRNfNfWHUI1Cd8Jvg+sbmIAVhIDvv4dUZrTLCrWYCdChWi36XVta6VjWQU5xwTQhEhpqociQVz6p6Eo9/mbx8drfEvQdyflnEliuTMBNg6tTb9JykZ81hpg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775544036; c=relaxed/simple; bh=PXH0Ixexzq4lbu1fRyzM+naW8Di7HO4c4pNCbFLJpSg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ERpRM/lpY9wIp9gRc6RI4vZ+pss+d+R3uxdYUokrN8M2M4sI8IdQZjO9OtJ5patGYdyqUNTdhLtfI/Yakswm4uQ3OnTqlVFnWFayzXJw61S/gCRkISShaHm4VvFCbWlSOTxbQS8YCYdTjnsYNFDNERcjLq28V9WQXA+eN93VNQw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=B+Ma0meQ; arc=none smtp.client-ip=209.85.215.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="B+Ma0meQ" Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-c70f91776fcso1811709a12.0 for ; Mon, 06 Apr 2026 23:40:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775544035; x=1776148835; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Wy9jQVOnIYjxy7FWem5JONQKIoJoRbyZ+S+kpmjt+7Q=; b=B+Ma0meQAYta8Py4pKX8zi8JHd5JY0A3rpW3/FO5X0QrLMwFiHHUd5slvkKYPkl7uj TVlGxNnBnCfGn61xGHVRYhyb9D/ldNf3KRJm2mXhcIWt3sJP/d9NDhnOe48L7ApTDFiM krPEfGQJf3qZejZJ7hQC2IqnmJ3CE+icNEg6LM9Nafk6JlB1BVmW9dclgguwXVH/mRVC apM8l30czuWVD6xwokc/iDtzP/3X0CwzO5lHWMzpuU9aVj7wprv9h7SCQS4GJ7/jXFQ7 8ocCDJWE8ljUhRp7K/+ZMR2I5on8RuSOsxKUo/MDZeJXYdlB8Fo52wy6/xe6xkFZlihk Kkrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775544035; x=1776148835; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Wy9jQVOnIYjxy7FWem5JONQKIoJoRbyZ+S+kpmjt+7Q=; b=mEh40K7QYPxT8ry+QRAMvT2783BpFMLJI5pJ7SfZNhvoMD7Y2pPka1oRb/qPxytQ8+ eGSPbO5YqBKf1JLXXA3KQ1pG6SmW99JuluJfZMAYvceBVVqXjeXPnAoX+WCeuSkR+EqF iOXvt0pQQZcA+yCzt6q2enH/E2hMezowA4myJs0V4KWHI8+XupEyPxyGTFSFGE8lKSiT BCv55koieB1Qkrz1oFmIsY9fx6p2Oj+Sn6WziQfPL02dNl/itQHp36v1MmVtcmGIRfD9 t4nUtf1qBxQHdu62yTFPlQeo90TEAkNFC8XS0RApnZqP5qvHzVKSgFTeKVIf6uOYXBZP mRFQ== X-Forwarded-Encrypted: i=1; AJvYcCUO9hGM5x5Z4wC6vqCWx26ISilQWd1jbIvZvVTj8M5eDDStSN3ojzmuaot1ztkzO0eKGgoFjEKmtpKVeGw=@vger.kernel.org X-Gm-Message-State: AOJu0YyOQ3EhUveMJkuNrMXvfj0Ntttbaza1xkVlxvj9tt902SpTi/Jl 2+1I2/hGD8qsCNDsyiXjj+dUIt60XuO29FU2xl+dnE0uDf0p6GNxFa0b X-Gm-Gg: AeBDievA8BzwgRN8n9z1hXgsQE5UKCKyXCMpXLKh6oUE3X9dSw4XzpIG2MRalq/dOzd ta2YYSOnef2aAiPx1JE6hDaEJ9+HsN0pCT/VMZxbo/16sgBaOVLt92t3qMm+rXnjpKwKnj1NYfJ F5fX31Q/EBjDwHMxnChVnjtcJItD/KVet/EV3J7tt7AOjRzAce8QXMBO9ldieE0CG9yVpfI9yta hBHCnawDKC/6e1orJYVdfSr2iJQJK6StWcHh7JpZcP/SzXgB10QijWPLhyUMElAXyjeUqKY4mQd Tb4dKKGisnAbNvkVKi92Nrd0o2G0gtmlJ+cmQhgXxZYEFxk/cZwIN9cu8Yltncho8YDF1TmEjbi BLdEZdTo5GQDfntc4dLFriXYN1ZCmTCZmF/2IRn6n0G3eUcuCmvm6gmEycfjVoVn5y1fGTqqfvH TutWvGdcAXcg2TwY5MS1cPv+vSVIiKLpEPKhL4OiXSwBt+jflI/ohRgriOdRMnvGsgBI4Si07D9 w34t5MSAHPTSxDR X-Received: by 2002:a05:6a21:9983:b0:39b:fbb2:5e31 with SMTP id adf61e73a8af0-39f2f09eec8mr15328230637.43.1775544034900; Mon, 06 Apr 2026 23:40:34 -0700 (PDT) Received: from localhost.localdomain ([45.248.78.44]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c76c65995a9sm13954320a12.27.2026.04.06.23.40.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2026 23:40:34 -0700 (PDT) From: Nathan Rebello To: gregkh@linuxfoundation.org, heikki.krogerus@linux.intel.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, tiwai@suse.de, stable@vger.kernel.org, Nathan Rebello Subject: [PATCH] usb: typec: ucsi: skip connector validation before init Date: Tue, 7 Apr 2026 02:39:58 -0400 Message-ID: <20260407063958.863-1-nathan.c.rebello@gmail.com> X-Mailer: git-send-email 2.43.0.windows.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Notifications can arrive before ucsi_init() has populated ucsi->cap.num_connectors via GET_CAPABILITY. At that point num_connectors is still 0, causing all valid connector numbers to be incorrectly rejected as bogus. Skip the bounds check when num_connectors is 0 (not yet initialized). Pre-init notifications are already handled safely by the early-event guard in ucsi_connector_change(). Reported-by: Takashi Iwai Fixes: d2d8c17ac01a ("usb: typec: ucsi: validate connector number in ucsi_n= otify_common()") Cc: stable@vger.kernel.org Signed-off-by: Nathan Rebello Acked-by: Heikki Krogerus Tested-by: Takashi Iwai --- drivers/usb/typec/ucsi/ucsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index b77910152399..7df3a7b94a40 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -43,7 +43,8 @@ void ucsi_notify_common(struct ucsi *ucsi, u32 cci) return; =20 if (UCSI_CCI_CONNECTOR(cci)) { - if (UCSI_CCI_CONNECTOR(cci) <=3D ucsi->cap.num_connectors) + if (!ucsi->cap.num_connectors || + UCSI_CCI_CONNECTOR(cci) <=3D ucsi->cap.num_connectors) ucsi_connector_change(ucsi, UCSI_CCI_CONNECTOR(cci)); else dev_err(ucsi->dev, "bogus connector number in CCI: %lu\n", --=20 2.43.0.windows.1