Skip to content

Commit e6d64ce

Browse files
author
Jiri Kosina
committed
Merge branch 'for-5.3/upstream-fixes' into for-linus
- syzbot memory corruption fixes for hidraw, Prodikeys, Logitech and Sony drivers from Alan Stern and Roderick Colenbrander - error handling fix for Logitech unifying receivers from Hans de Goede Signed-off-by: Jiri Kosina <[email protected]>
2 parents fcf887e + 98375b8 commit e6d64ce

File tree

7 files changed

+24
-17
lines changed

7 files changed

+24
-17
lines changed

drivers/hid/hid-lg.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
818818

819819
if (!buf) {
820820
ret = -ENOMEM;
821-
goto err_free;
821+
goto err_stop;
822822
}
823823

824824
ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(cbuf),
@@ -850,9 +850,12 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
850850
ret = lg4ff_init(hdev);
851851

852852
if (ret)
853-
goto err_free;
853+
goto err_stop;
854854

855855
return 0;
856+
857+
err_stop:
858+
hid_hw_stop(hdev);
856859
err_free:
857860
kfree(drv_data);
858861
return ret;
@@ -863,8 +866,7 @@ static void lg_remove(struct hid_device *hdev)
863866
struct lg_drv_data *drv_data = hid_get_drvdata(hdev);
864867
if (drv_data->quirks & LG_FF4)
865868
lg4ff_deinit(hdev);
866-
else
867-
hid_hw_stop(hdev);
869+
hid_hw_stop(hdev);
868870
kfree(drv_data);
869871
}
870872

drivers/hid/hid-lg4ff.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1477,7 +1477,6 @@ int lg4ff_deinit(struct hid_device *hid)
14771477
}
14781478
}
14791479
#endif
1480-
hid_hw_stop(hid);
14811480
drv_data->device_props = NULL;
14821481

14831482
kfree(entry);

drivers/hid/hid-logitech-dj.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,14 +1734,14 @@ static int logi_dj_probe(struct hid_device *hdev,
17341734
if (retval < 0) {
17351735
hid_err(hdev, "%s: logi_dj_recv_query_paired_devices error:%d\n",
17361736
__func__, retval);
1737-
goto logi_dj_recv_query_paired_devices_failed;
1737+
/*
1738+
* This can happen with a KVM, let the probe succeed,
1739+
* logi_dj_recv_queue_unknown_work will retry later.
1740+
*/
17381741
}
17391742
}
17401743

1741-
return retval;
1742-
1743-
logi_dj_recv_query_paired_devices_failed:
1744-
hid_hw_close(hdev);
1744+
return 0;
17451745

17461746
llopen_failed:
17471747
switch_to_dj_mode_fail:

drivers/hid/hid-prodikeys.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,10 +551,14 @@ static void pcmidi_setup_extra_keys(
551551

552552
static int pcmidi_set_operational(struct pcmidi_snd *pm)
553553
{
554+
int rc;
555+
554556
if (pm->ifnum != 1)
555557
return 0; /* only set up ONCE for interace 1 */
556558

557-
pcmidi_get_output_report(pm);
559+
rc = pcmidi_get_output_report(pm);
560+
if (rc < 0)
561+
return rc;
558562
pcmidi_submit_output_report(pm, 0xc1);
559563
return 0;
560564
}
@@ -683,7 +687,11 @@ static int pcmidi_snd_initialise(struct pcmidi_snd *pm)
683687
spin_lock_init(&pm->rawmidi_in_lock);
684688

685689
init_sustain_timers(pm);
686-
pcmidi_set_operational(pm);
690+
err = pcmidi_set_operational(pm);
691+
if (err < 0) {
692+
pk_error("failed to find output report\n");
693+
goto fail_register;
694+
}
687695

688696
/* register it */
689697
err = snd_card_register(card);

drivers/hid/hid-sony.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2811,7 +2811,6 @@ static int sony_input_configured(struct hid_device *hdev,
28112811
sony_cancel_work_sync(sc);
28122812
sony_remove_dev_list(sc);
28132813
sony_release_device_id(sc);
2814-
hid_hw_stop(hdev);
28152814
return ret;
28162815
}
28172816

@@ -2876,6 +2875,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
28762875
*/
28772876
if (!(hdev->claimed & HID_CLAIMED_INPUT)) {
28782877
hid_err(hdev, "failed to claim input\n");
2878+
hid_hw_stop(hdev);
28792879
return -ENODEV;
28802880
}
28812881

drivers/hid/hidraw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd,
370370

371371
mutex_lock(&minors_lock);
372372
dev = hidraw_table[minor];
373-
if (!dev) {
373+
if (!dev || !dev->exist) {
374374
ret = -ENODEV;
375375
goto out;
376376
}

drivers/hid/i2c-hid/i2c-hid-core.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,7 @@ static const struct i2c_hid_quirks {
169169
__u16 idProduct;
170170
__u32 quirks;
171171
} i2c_hid_quirks[] = {
172-
{ USB_VENDOR_ID_WEIDA, USB_DEVICE_ID_WEIDA_8752,
173-
I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV },
174-
{ USB_VENDOR_ID_WEIDA, USB_DEVICE_ID_WEIDA_8755,
172+
{ USB_VENDOR_ID_WEIDA, HID_ANY_ID,
175173
I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV },
176174
{ I2C_VENDOR_ID_HANTICK, I2C_PRODUCT_ID_HANTICK_5288,
177175
I2C_HID_QUIRK_NO_IRQ_AFTER_RESET |

0 commit comments

Comments
 (0)