usb: fix slab-out-of-bounds Read in cougar_report_fixup
PATCH 1/1 usb: fix slab-out-of-bounds Read in cougar_report_fixup
report_fixup for the Cougar 500k Gaming Keyboard was not verifying that the report descriptor size was correct before accessing it
Reported-by [email protected]
Signed-off-by Camila Alvarez <[email protected]>
--- drivers/hid/hid-cougar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-cougar.c +1 -1
@@ -106,7 +106,7 @@ static void cougar_fix_g6_mapping(void)static __u8 *cougar_report_fixup (struct hid_device *hdev,__u8 *rdesc,unsigned int *rsize) { -if (rdesc[2 ] ==0x09 && rdesc[3 ] ==0x02 && +if (*rsize >=117 && rdesc[2 ] ==0x09 && rdesc[3 ] ==0x02 && (rdesc[115 ] | rdesc[116 ] <<8 ) >=HID_MAX_USAGES ) {hid_info (hdev,"usage count exceeds max: fixing up report descriptor\n" );
Signature · 1 line
2.34.1
Quoted 9 lines · Camila Alvarez
report_fixupfor the Cougar 500k Gaming Keyboard was not verifying that the report descriptor size was correct before accessing itReported-by [email protected]Signed-off-by Camila Alvarez <[email protected]>--- drivers/hid/hid-cougar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
This LGTM!
Reviewed-by Silvan Jegen <[email protected]>
Quoted 18 lines
drivers/hid/hid-cougar.c +1
-1@@ -106,7 +106,7 @@ static void cougar_fix_g6_mapping(void)static __u8 *cougar_report_fixup (struct hid_device *hdev,__u8 *rdesc,unsigned int *rsize) { -if (rdesc[2 ] ==0x09 && rdesc[3 ] ==0x02 && +if (*rsize >=117 && rdesc[2 ] ==0x09 && rdesc[3 ] ==0x02 && (rdesc[115 ] | rdesc[116 ] <<8 ) >=HID_MAX_USAGES ) {hid_info (hdev,"usage count exceeds max: fixing up report descriptor\n" );Signature · 1 line
2.34.1
Quoted 6 lines · Camila Alvarez
report_fixupfor the Cougar 500k Gaming Keyboard was not verifying that the report descriptor size was correct before accessing itReported-by [email protected]Signed-off-by Camila Alvarez <[email protected]>
Applied, thanks.
Signature · 2 lines
Jiri Kosina SUSE Labs
Quoted 11 lines · Jiri Kosina
Quoted 6 lines · Camila Alvarez
report_fixupfor the Cougar 500k Gaming Keyboard was not verifying that the report descriptor size was correct before accessing itReported-by [email protected]Signed-off-by Camila Alvarez <[email protected]>Applied, thanks.
Thank you!
Quoted 5 lines
Signature · 2 lines
Jiri Kosina SUSE Labs