From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (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 6F5B62AE77 for ; Sat, 17 Jan 2026 00:43:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768610623; cv=none; b=AJT11SjNHmNu98juU1CA7gl3CG63WSF0AFY+HkbxyAL9EPjWVM2ybUlifJKMaihwy2lXzkMBL0qVN6CsGm23KtuydjbMR2t1yjMhH4GgwlNepadO90NBaCVZkfKvABkZp6RcbhCZYKUk4OguXfyOdoyXB+dSbFRwyRBfW9UIe80= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768610623; c=relaxed/simple; bh=7oHpyfvFo5aHQC3q9HZzJ646QxSFdCaU7tSFV/IZzWQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=n+2cze5PJqNpXw5EyETYnJmFqMTetmVSl+i2TcwsAh3FLekXSryBtyxGJwxs5YvABy6iO6rxwEDy9Tk3ajcre5VnTiDUX85Z7eOkg5cHt3pEphZZhf20srLdSW0/QQQH7TslccuFRb9YmR2TSHeE/td48XYEs2vzmwq2vgbhhaA= 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=Jz0tzYUn; arc=none smtp.client-ip=209.85.218.42 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="Jz0tzYUn" Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-b879d5c1526so236243166b.1 for ; Fri, 16 Jan 2026 16:43:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768610620; x=1769215420; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=21AXstw+KtwXhMbOLubkuYuqjDGhA81uz7GZPXnRfTI=; b=Jz0tzYUnwWpjiSiuhxHEuf6BIX7wgt8NBmoUqj/xtASGDyFIWCmnBu0WvHxN17Hd2M Gpa9vpO4oVw8mAj6IyIQdfxIHI/1cCkLztB34+25hlVLl+j2bML8Xw8LjXQfFxpm7NR/ gcm32LPOCfg8CspLjdXQ/+tB7cD5BY1Z92+bRSPCLPMQE5dW0huUVzKUxZ3ZtkHpK883 co3LzCWRLVGJHfw4x5KYbGOUOnhqF4a7VbjOm+ZRhwqnTFigy1w3YaDzKccBGxnE7e7v 2CRsqvxmzpDTs1R3AXeJQaSkxNvxvKsxFyxqymHtlooRE41MUN916483MHcOIh9NdKDd oSWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768610620; x=1769215420; h=in-reply-to:content-disposition:mime-version:references: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=21AXstw+KtwXhMbOLubkuYuqjDGhA81uz7GZPXnRfTI=; b=IeHHQ/UOX+qisQvMAkBmFMdJ979azc4lddpDRl29G+twJRGCJe31dxTGCbT6kFqFMY PAQopBfnJV2rq7TGn+UyLfPz8/rga1tYAc7lzkU2QDxz0MtRdE2bHKLFZYrUUIoiUnbN 5oTWw/lbZ9gaEVVNA4FcyDZyzUUgbTsUJZCAR1u86DK4xsphHtLoYP8u/mK/KYWi0NQY bnGvNkrsWBFg3XqayBsC2NAynuhAnqFLbEllE9Wsc2VNWpSwH6FdLzbkDfZ3gN2y5PL7 l8F1cEU87b/WCTqTWiPsm+g6jEx7/L8uxBMAdcbM+T0tCSo2fXp2XMfLUu2h6uKceM6u wtrA== X-Forwarded-Encrypted: i=1; AJvYcCWNpjLIk3rcFNGfA1bIpn4LibhpbEthes31MahzD3e4WlT1uSa8dLOZXzQ/E4SpA8/gb/9vlBQbXAc61Ac=@vger.kernel.org X-Gm-Message-State: AOJu0YxItn2/HJ9ANg8ZpoUa+D6xULldt309RINAbgJXlYF7LPfiC8zx QsUJybc8Vr5GQeapCce9NjS70kRjJ5iZbF54zvf0AJAv3039PmGu1jtG+um9dAPy X-Gm-Gg: AY/fxX5VkTg+AS5rBli35T8SuRP6s5me3Ic8dbsjodcs+DMwhF9tSUg2r1p5njqrhfY FT8Uw1rJDTOIMdQjohvnFP0qaDPKyiB+7Vy2xg/zSwz16iUxNJRnnEbRuqGySW2TDVE5KfS6m3n QhIVpsDWfyURzEB0FuxPxlIuFlJJ6iXv+AbGo0J1iXIVoIawPzZ6/PRImEB12VK6hOGILjjc8Oa al0Tjg6ealtfn4AaK9u+M9SXNq6dbVPjmP3JGsyVZDAhabslIwsYOFOlzLnFwp610OlJQtMqVyM EVrcBGDnHcFZU3Qzac58Iog7G9z58kK2QvT5DZCjdFrU351BP6EqABxfcmbz1pETanHsET13e/p DFR4/yl6YeBjv5TxSIlxIiwTuC4b5QeXhs8UQ+rNtqvYCWpPTNc82l2INKCEZxIoz2tsmaX+zal Jm7ejb/QbkfeOmB6fHh4zhplVT80wB18a5Z/zepEMeYgpg X-Received: by 2002:a05:6000:200d:b0:430:fafd:f1d2 with SMTP id ffacd0b85a97d-4356a0248fcmr5796166f8f.11.1768604885113; Fri, 16 Jan 2026 15:08:05 -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 ffacd0b85a97d-43569927007sm7590454f8f.16.2026.01.16.15.08.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jan 2026 15:08:04 -0800 (PST) Sender: Salvatore Bonaccorso Received: by eldamar.lan (Postfix, from userid 1000) id 910D4BE2EE7; Sat, 17 Jan 2026 00:08:03 +0100 (CET) Date: Sat, 17 Jan 2026 00:08:03 +0100 From: Salvatore Bonaccorso To: Greg KH Cc: xiaopeitux@foxmail.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Pei Xiao , Heikki Krogerus , pdormeau@free.fr Subject: Re: [RFC] usb: typec: ucsi: Fix array index out-of-bounds in altmode registration Message-ID: References: <176840984804.2144647.10736984532804520381@eldamar.lan> <2026011617-phantom-diploma-cd79@gregkh> 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 In-Reply-To: <2026011617-phantom-diploma-cd79@gregkh> Hi Greg, hi Heikki [sorry for getting this twice, my former email was broken] On Fri, Jan 16, 2026 at 12:22:42PM +0100, Greg KH wrote: > On Thu, Jan 15, 2026 at 11:32:01AM +0800, xiaopeitux@foxmail.com wrote: > > From: Pei Xiao > > > > Add boundary check to prevent array index out-of-bounds when PPM returns > > more alternate modes than expected. > > > > log: > > UBSAN: array-index-out-of-bounds in /build/reproducible-path/linux-6.17.13/drivers/usb/typec/ucsi/ucsi.c:609:18 > > index 2 is out of range for type 'ucsi_altmode [2]' > > 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 > > Hardware name: LENOVO 83J3/LNVNB161216, BIOS PYCN30WW 11/17/2025 > > Workqueue: events_long ucsi_init_work [typec_ucsi] > > Call Trace: > > > > dump_stack_lvl+0x5d/0x80 > > ubsan_epilogue+0x5/0x2b > > __ubsan_handle_out_of_bounds.cold+0x54/0x59 > > ucsi_register_altmodes+0x233/0x250 [typec_ucsi] > > ucsi_check_altmodes+0x1b/0xa0 [typec_ucsi] > > ucsi_init_work+0x919/0x9b0 [typec_ucsi] > > process_one_work+0x192/0x350 > > worker_thread+0x25a/0x3a0 > > > > Reported-by: Salvatore Bonaccorso > > Closes: https://lore.kernel.org/lkml/176840984804.2144647.10736984532804520381@eldamar.lan > > Signed-off-by: Pei Xiao > > --- > > drivers/usb/typec/ucsi/ucsi.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c > > index a7b388dc7fa0..00575a8720cc 100644 > > --- a/drivers/usb/typec/ucsi/ucsi.c > > +++ b/drivers/usb/typec/ucsi/ucsi.c > > @@ -599,6 +599,8 @@ static int ucsi_register_altmodes(struct ucsi_connector *con, u8 recipient) > > * incremented. > > */ > > num = len / sizeof(alt[0]); > > + if (num > ARRAY_SIZE(alt)) > > + num = ARRAY_SIZE(alt); > > As Heikki said, this is a broken hardware device, please fix that > instead as it will not work with any other operating system either :) Thanks a lot for looking into it. Pascal, can you pleas report this issue then to the vendor as it is a firmware bug? Regards, Salvatore