HID: logitech-dj: fix wrong detection of bad DJ_SHORT output report
Subsystems (2)
Benjamin Tissoires
maintainerPATCH 1/1 HID: logitech-dj: fix wrong detection of bad DJ_SHORT output report
commit b6a57912854e ("HID: logitech-dj: Prevent REPORT_ID_DJ_SHORT related user initiated OOB write") assumed that all HID devices attached to the logitech-dj driver was having an output report of DJ_SHORT.
However, on the receiver itself, we have 2 other HID device we attach
here: the mouse emulation and the keyboard emulation. For those devices the value of rep is NULL and we are triggered a segfault here.
This is doubly required because logitech-dj also handles non DJ devices that might not have the DJ collection.
--- drivers/hid/hid-logitech-dj.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-logitech-dj.c +2 -1
@@ -1907,7 +1907,8 @@ static int logi_dj_probe(struct hid_device *hdev, output_report_enum = &hdev->report_enum[HID_OUTPUT_REPORT ]; rep = output_report_enum->report_id_hash[REPORT_ID_DJ_SHORT ]; -if (rep->maxfield <1 || rep->field[0 ]->report_count !=DJREPORT_SHORT_LENGTH -1 ) { +if (rep && (rep->maxfield <1 || + rep->field[0 ]->report_count !=DJREPORT_SHORT_LENGTH -1 )) {hid_err (hdev,"Expected size of DJ short report is %d, but got %d" ,DJREPORT_SHORT_LENGTH -1 , rep->field[0 ]->report_count);return -EINVAL ;
---
base-commit: e2aaf2d3ad92ac4a8afa6b69ad4c38e7747d3d6e
change-id: 20260410-fix-logitech-dj-e9060b0b48bd
Best regards,
Signature · 1 line
Benjamin Tissoires <[email protected]>
Quoted 8 lines · Benjamin Tissoires
commit
b6a57912854e("HID: logitech-dj: PreventREPORT_ID_DJ_SHORTrelated user initiated OOB write") assumed that all HID devices attached to the logitech-dj driver was having an output report ofDJ_SHORT.However, on the receiver itself, we have 2 other HID device we attach
here: the mouse emulation and the keyboard emulation. For those devices the value of rep is NULL and we are triggered a segfault here.
Quoted 5 lines
This is doubly required because logitech-dj also handles non DJ devices that might not have the DJ collection.
Fixes b6a57912854e ("HID: logitech-dj: Prevent REPORT_ID_DJ_SHORT related user initiated OOB write")Signed-off-by Benjamin Tissoires <[email protected]>
Thanks a lot Benjamin, your CI be praised!
Applied.
Signature · 2 lines
Jiri Kosina SUSE Labs
Lee Jones
Reviewed-byQuoted 10 lines · Jiri Kosina
Quoted 8 lines · Benjamin Tissoires
commit
b6a57912854e("HID: logitech-dj: PreventREPORT_ID_DJ_SHORTrelated user initiated OOB write") assumed that all HID devices attached to the logitech-dj driver was having an output report ofDJ_SHORT.However, on the receiver itself, we have 2 other HID device we attach
here: the mouse emulation and the keyboard emulation. For those devices the value of rep is NULL and we are triggered a segfault here.
Quoted 7 lines
Quoted 5 lines
This is doubly required because logitech-dj also handles non DJ devices that might not have the DJ collection.
Fixes b6a57912854e ("HID: logitech-dj: Prevent REPORT_ID_DJ_SHORT related user initiated OOB write")Signed-off-by Benjamin Tissoires <[email protected]>Thanks a lot Benjamin, your CI be praised!
Thanks Benjamin. I appreciate your work.
If it's not too late:
Signature · 1 line
Lee Jones [李琼斯]