mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-05-05 09:57:21 +02:00
HID: logitech-hidpp: Check maxfield in hidpp_get_report_length()
[ Upstream commit 1547d41f9f ]
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>
This commit is contained in:
committed by
Sasha Levin
parent
e7ac1cd823
commit
f1ceaaf93e
@@ -4341,7 +4341,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;
|
||||
|
||||
Reference in New Issue
Block a user