From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 E0F5D4582FE; Tue, 21 Jul 2026 22:22:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784672574; cv=none; b=Vozp22XHT41ADzR0BEjg0ZsaPXG9NhhtDyK1b5yup+9ggyoqh7c7nhCn2XCpl5mND5y+9U5bx86SZt7jGKqvQvox7RAFdCBtFCX0oq+8YKzkFvl2emeQFPmMr+nkS6lbBKQhUGQHqhcBG+yLF86UyCEXWJlkjYoAJR/CCiINqmQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784672574; c=relaxed/simple; bh=C39h9ObNNgVvQKgxjqMfY8wPqiHfpxXY/iJqGW9Xxxg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V+K92q4fKiayFmvGV7WhESKKUdpbJVyTk7mfRN/3dsoXH2r5nxFuPnyWxwtieRoaGnvLp9dpJtkRXw8M3IIL+DVahaFBXxQgpmLq/hMs8joNeYaekwbjao3N4kiWURTXj1WgvCunJj5V4z7GeItOsds2DmDBNEE/52d0oNhulcc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nuM/RwdS; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="nuM/RwdS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53DB61F000E9; Tue, 21 Jul 2026 22:22:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784672573; bh=RlVlb3b/+q9jrM0Myz3U0z0oKFD0pISkJtVtigTATrY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nuM/RwdStLo2ulZl51V6deggzh/WwLJ2cBfa0lWOaiIpR4bNCvB7a3or6Vo/sfqKR ttN5ahSJBgvurCBYB+yqWZ6pmE5bAgotUQ3LVRNH8Ym9R3772Dx6mgn3Ado+WKb4Kf CZsDWSP/22fjyZ2o2ddUQ7b7NgQeqxC9iKIEMATE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dmitry Torokhov Subject: [PATCH 5.15 674/843] Input: ims-pcu - fix potential infinite loop in CDC union descriptor parsing Date: Tue, 21 Jul 2026 17:25:09 +0200 Message-ID: <20260721152421.222923574@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152405.946368001@linuxfoundation.org> References: <20260721152405.946368001@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 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Torokhov commit d4579af29e67ca8722db0a1194227f8015c8981d upstream. The driver parses CDC union descriptors in ims_pcu_get_cdc_union_desc() by iterating through the extra descriptor data. However, it does not verify that the bLength of each descriptor is at least 2. A malicious device could provide a descriptor with bLength = 0, leading to an infinite loop in the driver. Add a check to ensure bLength is at least 2 before proceeding with parsing. Fixes: 628329d52474 (Input: add IMS Passenger Control Unit driver) Cc: stable@vger.kernel.org Assisted-by: Gemini:gemini-3.1-pro Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/misc/ims-pcu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/input/misc/ims-pcu.c +++ b/drivers/input/misc/ims-pcu.c @@ -1675,8 +1675,9 @@ ims_pcu_get_cdc_union_desc(struct usb_in while (buflen >= sizeof(*union_desc)) { union_desc = (struct usb_cdc_union_desc *)buf; - if (union_desc->bLength > buflen) { - dev_err(&intf->dev, "Too large descriptor\n"); + if (union_desc->bLength < 2 || union_desc->bLength > buflen) { + dev_err(&intf->dev, "Invalid descriptor length: %d\n", + union_desc->bLength); return NULL; }