From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
stable <stable@kernel.org>
Subject: Re: [PATCH] Input: usbtouchscreen - clamp NEXIO data_len/x_len to URB buffer size
Date: Sun, 26 Apr 2026 21:00:41 -0700 [thread overview]
Message-ID: <ae7fXWVgR7oYfrUC@google.com> (raw)
In-Reply-To: <2026042026-chlorine-epidermis-fd6d@gregkh>
On Mon, Apr 20, 2026 at 06:00:27PM +0200, Greg Kroah-Hartman wrote:
> 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 <dmitry.torokhov@gmail.com>
> Fixes: 5197424cdccc ("Input: usbtouchscreen - add NEXIO (or iNexio) support")
> Cc: stable <stable@kernel.org>
> Assisted-by: gkh_clanker_t1000
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Applied, thank you.
--
Dmitry
prev parent reply other threads:[~2026-04-27 4:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-20 16:00 [PATCH] Input: usbtouchscreen - clamp NEXIO data_len/x_len to URB buffer size Greg Kroah-Hartman
2026-04-27 4:00 ` Dmitry Torokhov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ae7fXWVgR7oYfrUC@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox