linux/drivers/hid/i2c-hid
Kwok Kin Ming 2497ff38c5 HID: i2c-hid: fix potential buffer overflow in i2c_hid_get_report()
`i2c_hid_xfer` is used to read `recv_len + sizeof(__le16)` bytes of data
into `ihid->rawbuf`.

The former can come from the userspace in the hidraw driver and is only
bounded by HID_MAX_BUFFER_SIZE(16384) by default (unless we also set
`max_buffer_size` field of `struct hid_ll_driver` which we do not).

The latter has size determined at runtime by the maximum size of
different report types you could receive on any particular device and
can be a much smaller value.

Fix this by truncating `recv_len` to `ihid->bufsize - sizeof(__le16)`.

The impact is low since access to hidraw devices requires root.

Signed-off-by: Kwok Kin Ming <kenkinming2002@gmail.com>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
History 2026-01-07 18:35:58 +01:00
..
i2c-hid-acpi.c HID: i2c-hid: Resolve touchpad issues on Dell systems during S4 2025-09-16 10:24:46 +02:00
i2c-hid-core.c HID: i2c-hid: fix potential buffer overflow in i2c_hid_get_report() 2026-01-07 18:35:58 +01:00
i2c-hid-dmi-quirks.c HID: retain initial quirks set up when creating HID devices 2023-02-09 14:24:30 +01:00
i2c-hid-of-elan.c HID: i2c-hid: Make elan touch controllers power on after panel is enabled 2025-08-25 09:18:39 -07:00
i2c-hid-of-goodix.c Merge branch 'for-6.5/i2c-hid' into for-linus 2023-06-27 22:42:28 +02:00
i2c-hid-of.c HID: i2c-hid-of: Drop explicit initialization of struct i2c_device_id::driver_data to 0 2024-10-08 08:51:10 +02:00
i2c-hid.h HID: i2c-hid: Resolve touchpad issues on Dell systems during S4 2025-09-16 10:24:46 +02:00
Kconfig HID: intel-thc: fix CONFIG_HID dependency 2025-02-03 10:56:43 +01:00
Makefile HID: i2c-hid: elan: Add support for Elan eKTH6915 i2c-hid touchscreens 2022-06-08 11:46:23 +02:00