]> git.hungrycats.org Git - linux/commit
HID: cp2112: validate response report lengths
authorJiale Yao <yaojiale02@163.com>
Thu, 24 Sep 2026 14:44:06 +0000 (22:44 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Nov 2026 17:06:10 +0000 (12:06 -0500)
commit94d0e789d8b0d2ea8e25ed5ff2fe2648e11f2297
treeedc92c6d223b757a2b2c2791246af3e2af0b794a
parentd618e93e9cf5611867b3a7546e09bedff4b65139
HID: cp2112: validate response report lengths

commit fc54e71a063c0dcc4bceba6d0f71805a9b84082d upstream.

The HID core invokes raw_event callbacks before validating the report
length.  cp2112_raw_event() reads every field of a transfer status response
without checking size.  For a data response, it reads the length at offset
two and copies that many bytes from offset three, again without ensuring
that the input report contains them.

Require a complete transfer status structure.  For data responses, first
require the header and then ensure the clamped payload length fits in the
received report before copying it.

Commit 47669bec44fe ("HID: asus: refactor the two workqueues and init
sequence") added the same kind of raw_event length validation to hid-asus.

Fixes: e932d8178667 ("HID: add hid-cp2112 driver")
Cc: stable@vger.kernel.org
Signed-off-by: Jiale Yao <yaojiale02@163.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hid/hid-cp2112.c