diff options
| author | Günther Noack <gnoack@google.com> | 2026-01-09 13:25:58 +0100 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.com> | 2026-01-10 10:29:37 +0100 |
| commit | 1547d41f9f19d691c2c9ce4c29f746297baef9e9 (patch) | |
| tree | 23174263973e528be933b556944db9a68b801b97 /drivers/hid | |
| parent | cee8337e1bad168136aecfe6416ecd7d3aa7529a (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.c | 2 |
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; |
