summaryrefslogtreecommitdiff
path: root/drivers/hid
diff options
context:
space:
mode:
authorGünther Noack <gnoack@google.com>2026-01-09 13:25:58 +0100
committerJiri Kosina <jkosina@suse.com>2026-01-10 10:29:37 +0100
commit1547d41f9f19d691c2c9ce4c29f746297baef9e9 (patch)
tree23174263973e528be933b556944db9a68b801b97 /drivers/hid
parentcee8337e1bad168136aecfe6416ecd7d3aa7529a (diff)
HID: logitech-hidpp: Check maxfield in hidpp_get_report_length()
Do not crash when a report has no fields. Fake USB gadgets can send their own HID report descriptors and can define report structures without valid fields. This can be used to crash the kernel over USB. Cc: stable@vger.kernel.org Signed-off-by: Günther Noack <gnoack@google.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-logitech-hidpp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index e871f1729d4b..d0a38eff9cfa 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -4314,7 +4314,7 @@ static int hidpp_get_report_length(struct hid_device *hdev, int id)
re = &(hdev->report_enum[HID_OUTPUT_REPORT]);
report = re->report_id_hash[id];
- if (!report)
+ if (!report || !report->maxfield)
return 0;
return report->field[0]->report_count + 1;