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 A377937C912; Tue, 16 Jun 2026 15:04:23 +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=1781622264; cv=none; b=WaysNgtIodqBArcuAwVFItCvy1GBWc7pBbq6vDL6VzU0jIs5ONg5vf1GMW245sX1IXnrHpVVvkp2L+kFSvSduxPTaDrbgPXNv7ijlPSaXWJgy4xbzBGUM4d3NHRbNx1ADFryt95zTQBLF6vBO+iEiYsNZvPIHeDdNLGqyPVbNm0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781622264; c=relaxed/simple; bh=1Y3NVUVbiI5CvvAGNgnyBkM1P/IpKDJDcvwc5G91jcQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FT3knmrO+Gl/morWCkfpaEkIjifBhwCvSK4b6xDAW1CQSucVaMMWaswRSFiI5pkpx6x5IBu+y3jX2ltemgEB9k+sNAY3PD/R+AGPeBNxXKcfkI9vWYHPKws3S7olfFyEVhDpkPjSOBhSxbu0IIMgFE6ry/zNTaJdV1MpPBtpa6g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=iX1/YGE+; 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="iX1/YGE+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 543D61F000E9; Tue, 16 Jun 2026 15:04:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781622263; bh=LX2o7zh53erOvkFBhEavuIdZBIJdhW+HBBBiCRk1EsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=iX1/YGE+y0xuD/KSN+YNb9R//cOv2A4Q0WwI7zIC30/hnbmSR2ctR2qSL6WKNctsG K723EaXaZLKdmIHj4mATMHPtHZ11VNsKrfiHYheTZ1cVpsSLJMqXn9vvAsn9k2hF2+ BDuq6UO4o11exmCeRM5lntHu5GC2A0unYsEstyu8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dmitry Torokhov , stable Subject: [PATCH 6.6 001/452] Input: usbtouchscreen - clamp NEXIO data_len/x_len to URB buffer size Date: Tue, 16 Jun 2026 20:23:48 +0530 Message-ID: <20260616145117.873019671@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145117.796205997@linuxfoundation.org> References: <20260616145117.796205997@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Greg Kroah-Hartman commit 2905281cbda52ec9df540113b35b835feb5fafd3 upstream. nexio_read_data() pulls data_len and x_len from a packed __be16 header in the device's interrupt packet and then walks packet->data[0..x_len) and packet->data[x_len..data_len) comparing each byte against a threshold. Both fields are 16-bit on the wire (max 65535). The existing adjustments shave at most 0x100 / 0x80 off, so the loop bound can still reach roughly 0xfeff. The URB transfer buffer for NEXIO is rept_size (1024) bytes from usb_alloc_coherent(), with the first 7 occupied by the packed header — so packet->data[] has 1017 valid bytes. read_data() callbacks are not given urb->actual_length, and nothing else bounds the walk. A device that lies about its length can get a ~64 KiB out-of-bounds read past the coherent DMA allocation. The first index whose byte exceeds NEXIO_THRESHOLD lands in begin_x / begin_y and from there into the reported touch coordinates, so adjacent kernel memory contents leak to userspace as ABS_X / ABS_Y events. Far enough out, the read can also hit an unmapped page and fault. Fix this all by clamping data_len to the buffer's data[] capacity and x_len to data_len. Cc: Dmitry Torokhov Fixes: 5197424cdccc ("Input: usbtouchscreen - add NEXIO (or iNexio) support") Cc: stable Assisted-by: gkh_clanker_t1000 Signed-off-by: Greg Kroah-Hartman Link: https://patch.msgid.link/2026042026-chlorine-epidermis-fd6d@gregkh Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/touchscreen/usbtouchscreen.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c @@ -1061,6 +1061,11 @@ static int nexio_read_data(struct usbtou if (x_len > 0xff) x_len -= 0x80; + if (data_len > usbtouch->data_size - sizeof(*packet)) + data_len = usbtouch->data_size - sizeof(*packet); + if (x_len > data_len) + x_len = data_len; + /* send ACK */ ret = usb_submit_urb(priv->ack, GFP_ATOMIC); if (ret)