Skip to content

Commit 9446edb

Browse files
keesJiri Kosina
authored andcommitted
HID: sony: validate HID output report details
This driver must validate the availability of the HID output report and its size before it can write LED states via buzz_set_leds(). This stops a heap overflow that is possible if a device provides a malicious HID output report: [ 108.171280] usb 1-1: New USB device found, idVendor=054c, idProduct=0002 ... [ 117.507877] BUG kmalloc-192 (Not tainted): Redzone overwritten CVE-2013-2890 Signed-off-by: Kees Cook <[email protected]> Cc: [email protected] #3.11 Reviewed-by: Benjamin Tissoires <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 78214e8 commit 9446edb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/hid/hid-sony.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,10 @@ static int buzz_init(struct hid_device *hdev)
537537
drv_data = hid_get_drvdata(hdev);
538538
BUG_ON(!(drv_data->quirks & BUZZ_CONTROLLER));
539539

540+
/* Validate expected report characteristics. */
541+
if (!hid_validate_values(hdev, HID_OUTPUT_REPORT, 0, 0, 7))
542+
return -ENODEV;
543+
540544
buzz = kzalloc(sizeof(*buzz), GFP_KERNEL);
541545
if (!buzz) {
542546
hid_err(hdev, "Insufficient memory, cannot allocate driver data\n");

0 commit comments

Comments
 (0)