diff options
| author | Günther Noack <gnoack@google.com> | 2026-01-09 15:25:58 +0300 |
|---|---|---|
| committer | Sasha Levin <sashal@kernel.org> | 2026-03-04 15:20:43 +0300 |
| commit | 7f59999fcd699af06ad2aef446a635ea6aa87db3 (patch) | |
| tree | 46c7f1fc06a4557e1d6edbcaa3fafb81eb261156 /drivers/hid | |
| parent | edccbf7d6dc05d692bde3a89de5a4001f72a0fa4 (diff) | |
| download | linux-7f59999fcd699af06ad2aef446a635ea6aa87db3.tar.xz | |
HID: logitech-hidpp: Check maxfield in hidpp_get_report_length()
[ Upstream commit 1547d41f9f19d691c2c9ce4c29f746297baef9e9 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
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 fa1c7e07e220..c65b5f004bac 100644 --- a/drivers/hid/hid-logitech-hidpp.c +++ b/drivers/hid/hid-logitech-hidpp.c @@ -4082,7 +4082,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; |
