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 7533035C6A3; Tue, 21 Jul 2026 21:44:24 +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=1784670265; cv=none; b=bguuHpWdUq69sAfR3yvdcpawfinMZFARuWr46z7/yYIZwAa2uS2FXuLwFLoUhScrRItTXOkLtyQ1lNATmivwlpu6YY2OH/vu+1CXba9Bc/9k1LhwP70UVPRXd6I3vgGWf0iboAulp1mCtK+ImtR2VH8mHRJmJYQj51qgKd+e+w0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784670265; c=relaxed/simple; bh=3Ed9pxNnDnwQMgtBx+3dagJaA9G5V+njON4uv+ZLGLQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V6qfuzRtVeckbd9FnRsTsP+ocye9bGzpZxb6Ui98Hbo6QzOb383yVucB51fHicKdcIZ06U2EA1QnXeoY8vqa7HVIO8O/7YVXkWCf9xNL7QDOoh474yu3/LgTIoS4O3M4JDduaxaovdz3wDY3aSqEureQCzHAysMRnAw4tRY6pxA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=C1sb68Lq; 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="C1sb68Lq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9A541F000E9; Tue, 21 Jul 2026 21:44:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784670264; bh=pWeXe51G/qVyqazc44M0E20KBzFVdcU1bmdpWexpfpY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=C1sb68LqiH50VGf6yR36tlnuuu48o+YbNqJTmL6cfx0HeeHHLRFhy0TaCSPsBaHQK hl24QbgooIRFay7+Tq7DcwmW71DvHsOs7F1d1hI6qv9iuSUMt5W0Q2Rx6kcAdoAaJx gWgWq4GhXF9Rfmu5uSi8ieK1NBvU3uM67ESeP6AA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dmitry Torokhov Subject: [PATCH 6.1 0867/1067] Input: ims-pcu - fix potential infinite loop in CDC union descriptor parsing Date: Tue, 21 Jul 2026 17:24:28 +0200 Message-ID: <20260721152443.934422774@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152424.521567757@linuxfoundation.org> References: <20260721152424.521567757@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.1-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; }