From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (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 7456C2E7F1D for ; Wed, 14 Jan 2026 18:39:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768415952; cv=none; b=qntkQ1GXsnbE+1DyJmwzP6o1Ihl8o0aSRONzZg79gwFxIxJ8PwhZbpo5e6eVwvJhxT7sWYL806H+/d5RonIRhd0f3b3nrlJS3r7Wi+cBjSsaMJvBeQi3oPPgNUR+Ni26O5xqrbs0hA7u3yNu/NSLfdnjqkmI+AIFDtwvLgSh0d8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768415952; c=relaxed/simple; bh=gIkLV+3FI+9dZKIY8vmxAnUjUtjc/p76UJ4h1b/KoXo=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=LC8B1Nh1Npn8ICIm/ZOU4T14dFGhTvwUXaPLVsFLmMPHNNVTceGOtkts0teLe5eHhueMZV9eex0m5FjVOQ69M7+k4z17GKPC/xZnf0dg00gcmLJj0Nx1i2BCoHh9YPOGGHWYWnL5RyrKirhNdHOwF0mAV0XEhiS+e/mzd/lV5zU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FIS7jBJa; arc=none smtp.client-ip=209.85.208.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org 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="FIS7jBJa" Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-382fa0dc9f4so923351fa.3 for ; Wed, 14 Jan 2026 10:39:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768415948; x=1769020748; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :sender:from:to:cc:subject:date:message-id:reply-to; bh=lBn8g7AHhTvzdGXVwrOL6JsNt3dO9sitmYqcNNqbO8k=; b=FIS7jBJahXueHQOE5BD2jya6Rh599IM1ooRhB08w6/JWv6tD81wWI4UNAuzwVpuxFT WZHZp0AbjNub4hmFSgoAIjS9yEXDhd0kUm57Y0OiWKXjb0yph5ZqA4rdP+14SwWZ6lZ+ WDH+SSk9cxq1+mCJ7UfukWncmWI7NTDNiBHpG0Ly7940G853dMyKS7m2LlXM1kEItSSG eGNlTzGV8wxdT08g1rGQpYzv7OANHc+M6aVmXd0mJ5YRsrqHB3+h9DpADfOUrHGD6hkI 3hz8DEC4J9R44MC/y1J2u2IAB6CjINO8M8ZeTM4qF2dwlFGykk53mmfs70U9zjvdXpLe 0RlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768415948; x=1769020748; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :sender:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=lBn8g7AHhTvzdGXVwrOL6JsNt3dO9sitmYqcNNqbO8k=; b=E1nznp4VHz40ZJVl/hFVav7CGk+hVZjUj/M3geuyegjkuqJUWCE7Az251EIc5Zq6hM SKmRJoId3mdFM0imisV7ywWAokCrRjkvHbCQyeL614b5Z48EVaJSYhryCLd9uGQ1UtZx hdwsEFmqifnKi74cUpjbhOFtLtxIJANS/8vW+hgwNQ1j/8Loj4yD2YArAzbSh2MUxQ9Q IvS5OUQ1ax/U3Kp4AahZVY/PS4bLtt5IHZEwXoCQLiCYy+j7uuWCGt3mcM2V5LRbw/CS xkQprMYNKauMutX/GOZjrZkVnh7G3O2+8C/tEUh1o6cCWgrJIhJjBdbqJKrze4ICWqNj tBPA== X-Forwarded-Encrypted: i=1; AJvYcCVeFYsLbckZfyR439U3aTRrA4H6/0oFsPAhmYRKqpjfxIH4gfn+4LXucagQnwtgONi9bMtr9GRAa31Ewrs=@vger.kernel.org X-Gm-Message-State: AOJu0YxUYPvu7nQPFNl7FfyXPCTbR7vpmMxzp9DxTwKJfP+zh2p+wQ15 CuHcPQB+pArYj2sTex3lgeZD9MZTZBordYkro+S3bG2JgbaUVAjV/Kbicym5oRPx3DI= X-Gm-Gg: AY/fxX72OD1SDDt6sMyiVi+2OzfwTVW0XpJ1XBNe1xi8nO/sTqw3A2ryQKseOueK6ho XtOC1iQeNNTnD0wX7FXDxSABZHDBadFNfoE5qFmg4a3/BGi5kcdFMYh91r1E9g59P80XKH4XF+b 45CbMXH3JZ4a2FiVFySb7DcZ+SK4wtx1Lp+qMUCgp+ddz8QPOvGn+6MJ10zzMlMYwWOAx8+95pR WIaWmpCSXX14eTbu82NbxT7n6UoMciSY2j2iyicBjKgZewF9aEz7+JX0crGwB4BNcn5m38XeCty 9xLRwAWF1T+ThnnXoUuITTfLARnWTP22eCpS0NDAcvIvB/uX8CJCquAnT88bAVujsnw4j99HpSg aXCXEDnefAlA+tuezSjtmlGl4xCLhCFi3GQ0T+M/ZjogeFuHt3Gojs9D85jap/D7/eSHAmN1S2J S8oD0EnYDebQzBY+kTwn/clTlSgs28f2UA2fPyHpjDB8yX X-Received: by 2002:a05:600c:1c20:b0:47e:e712:aa88 with SMTP id 5b1f17b1804b1-47ee712ac96mr1739685e9.31.1768409936259; Wed, 14 Jan 2026 08:58:56 -0800 (PST) Received: from eldamar.lan (c-82-192-244-13.customer.ggaweb.ch. [82.192.244.13]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47f428f1ba7sm1108765e9.15.2026.01.14.08.58.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jan 2026 08:58:55 -0800 (PST) Sender: Salvatore Bonaccorso Received: by eldamar.lan (Postfix, from userid 1000) id 39487BE2EE7; Wed, 14 Jan 2026 17:58:54 +0100 (CET) Date: Wed, 14 Jan 2026 17:58:54 +0100 From: Salvatore Bonaccorso To: Heikki Krogerus , Greg Kroah-Hartman , pdormeau@free.fr Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, 1123987@bugs.debian.org Subject: UBSAN: array-index-out-of-bounds in [...]drivers/usb/typec/ucsi/ucsi.c:605:12: index 2 is out of range for type 'ucsi_altmode [2]' Message-ID: <176840984804.2144647.10736984532804520381@eldamar.lan> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Control: forwarded -1 https://lore.kernel.org/lkml/176840984804.2144647.10736984532804520381@eldamar.lan Hi Pascal reported in Debian in https://bugs.debian.org/1123987 a problem catched by UBSAN in drivers/usb/typec/ucsi/ucsi.c: [ +1,022859] ------------[ cut here ]------------ [ +0,000008] UBSAN: array-index-out-of-bounds in /build/reproducible-path/linux-6.17.13/drivers/usb/typec/ucsi/ucsi.c:605:12 [ +0,001186] index 2 is out of range for type 'ucsi_altmode [2]' [ +0,000578] CPU: 10 UID: 0 PID: 275 Comm: kworker/10:1 Not tainted 6.17.13+deb14-amd64 #1 PREEMPT(lazy) Debian 6.17.13-1 [ +0,000005] Hardware name: LENOVO 83J3/LNVNB161216, BIOS PYCN30WW 11/17/2025 [ +0,000002] Workqueue: events_long ucsi_init_work [typec_ucsi] [ +0,000010] Call Trace: [ +0,000003] [ +0,000003] dump_stack_lvl+0x5d/0x80 [ +0,000007] ubsan_epilogue+0x5/0x2b [ +0,000005] __ubsan_handle_out_of_bounds.cold+0x54/0x59 [ +0,000007] ucsi_register_altmodes+0x214/0x250 [typec_ucsi] [ +0,000007] ucsi_check_altmodes+0x1b/0xa0 [typec_ucsi] [ +0,000004] ucsi_init_work+0x919/0x9b0 [typec_ucsi] [ +0,000005] process_one_work+0x192/0x350 [ +0,000006] worker_thread+0x25a/0x3a0 [ +0,000004] ? __pfx_worker_thread+0x10/0x10 [ +0,000003] kthread+0xfc/0x240 [ +0,000003] ? __pfx_kthread+0x10/0x10 [ +0,000002] ? __pfx_kthread+0x10/0x10 [ +0,000002] ret_from_fork+0x197/0x1c0 [ +0,000005] ? __pfx_kthread+0x10/0x10 [ +0,000002] ret_from_fork_asm+0x1a/0x30 [ +0,000008] [ +0,000001] ---[ end trace ]--- [ +0,000006] ------------[ cut here ]------------ [ +0,000002] UBSAN: array-index-out-of-bounds in /build/reproducible-path/linux-6.17.13/drivers/usb/typec/ucsi/ucsi.c:609:18 [ +0,000579] index 2 is out of range for type 'ucsi_altmode [2]' [ +0,000562] CPU: 10 UID: 0 PID: 275 Comm: kworker/10:1 Not tainted 6.17.13+deb14-amd64 #1 PREEMPT(lazy) Debian 6.17.13-1 [ +0,000003] Hardware name: LENOVO 83J3/LNVNB161216, BIOS PYCN30WW 11/17/2025 [ +0,000001] Workqueue: events_long ucsi_init_work [typec_ucsi] [ +0,000005] Call Trace: [ +0,000001] [ +0,000001] dump_stack_lvl+0x5d/0x80 [ +0,000004] ubsan_epilogue+0x5/0x2b [ +0,000003] __ubsan_handle_out_of_bounds.cold+0x54/0x59 [ +0,000005] ucsi_register_altmodes+0x233/0x250 [typec_ucsi] [ +0,000006] ucsi_check_altmodes+0x1b/0xa0 [typec_ucsi] [ +0,000004] ucsi_init_work+0x919/0x9b0 [typec_ucsi] [ +0,000005] process_one_work+0x192/0x350 [ +0,000004] worker_thread+0x25a/0x3a0 [ +0,000004] ? __pfx_worker_thread+0x10/0x10 [ +0,000003] kthread+0xfc/0x240 [ +0,000002] ? __pfx_kthread+0x10/0x10 [ +0,000002] ? __pfx_kthread+0x10/0x10 [ +0,000003] ret_from_fork+0x197/0x1c0 [ +0,000003] ? __pfx_kthread+0x10/0x10 [ +0,000002] ret_from_fork_asm+0x1a/0x30 [ +0,000006] [ +0,000001] ---[ end trace ]--- [ +0,000006] ------------[ cut here ]------------ [ +0,000001] UBSAN: array-index-out-of-bounds in /build/reproducible-path/linux-6.17.13/drivers/usb/typec/ucsi/ucsi.c:610:19 [ +0,000608] index 2 is out of range for type 'ucsi_altmode [2]' [ +0,000597] CPU: 10 UID: 0 PID: 275 Comm: kworker/10:1 Not tainted 6.17.13+deb14-amd64 #1 PREEMPT(lazy) Debian 6.17.13-1 [ +0,000003] Hardware name: LENOVO 83J3/LNVNB161216, BIOS PYCN30WW 11/17/2025 [ +0,000001] Workqueue: events_long ucsi_init_work [typec_ucsi] [ +0,000004] Call Trace: [ +0,000002] [ +0,000001] dump_stack_lvl+0x5d/0x80 [ +0,000004] ubsan_epilogue+0x5/0x2b [ +0,000003] __ubsan_handle_out_of_bounds.cold+0x54/0x59 [ +0,000004] ucsi_register_altmodes+0x1fa/0x250 [typec_ucsi] [ +0,000006] ucsi_check_altmodes+0x1b/0xa0 [typec_ucsi] [ +0,000004] ucsi_init_work+0x919/0x9b0 [typec_ucsi] [ +0,000006] process_one_work+0x192/0x350 [ +0,000004] worker_thread+0x25a/0x3a0 [ +0,000003] ? __pfx_worker_thread+0x10/0x10 [ +0,000003] kthread+0xfc/0x240 [ +0,000002] ? __pfx_kthread+0x10/0x10 [ +0,000002] ? __pfx_kthread+0x10/0x10 [ +0,000003] ret_from_fork+0x197/0x1c0 [ +0,000003] ? __pfx_kthread+0x10/0x10 [ +0,000002] ret_from_fork_asm+0x1a/0x30 [ +0,000006] [ +0,000001] ---[ end trace ]--- While I initially asked if Pascal can check as well mainline additionally to the tested 6.18.2 version, the problematic code seems still present, so I'm forwarding it now. Regards, Salvatore