linux/net/bluetooth/hidp
Muhammad Bilal 2a3ac9ee11 Bluetooth: HIDP: fix missing length checks in hidp_input_report()
hidp_input_report() reads keyboard and mouse payload data from an skb
without first verifying that skb->len contains enough data.

hidp_recv_intr_frame() pulls the 1-byte HIDP header before dispatching
to hidp_input_report(). If a paired device sends a truncated packet,
the handler reads beyond the valid skb data, resulting in an
out-of-bounds read of skb data. The OOB bytes may be interpreted as
phantom key presses or spurious mouse movement.

Replace the open-coded length tracking and pointer arithmetic with
skb_pull_data() calls. skb_pull_data() returns NULL if the requested
bytes are not present, eliminating the need for a manual size variable
and the separate skb->len guard.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
History 2026-05-27 16:44:02 -04:00
..
core.c Bluetooth: HIDP: fix missing length checks in hidp_input_report() 2026-05-27 16:44:02 -04:00
hidp.h hidp: constify hidp_connection_add() 2018-09-10 12:41:07 -04:00
Kconfig HID: intel-thc: fix CONFIG_HID dependency 2025-02-03 10:56:43 +01:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
sock.c Bluetooth: Init sk_peer_* on bt_sock_alloc 2023-08-11 11:37:22 -07:00