Commit e6d64ce0 authored by Jiri Kosina's avatar Jiri Kosina

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: default avatarJiri Kosina <jkosina@suse.cz>
parents fcf887e7 98375b86
...@@ -818,7 +818,7 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -818,7 +818,7 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
if (!buf) { if (!buf) {
ret = -ENOMEM; ret = -ENOMEM;
goto err_free; goto err_stop;
} }
ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(cbuf), 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) ...@@ -850,9 +850,12 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
ret = lg4ff_init(hdev); ret = lg4ff_init(hdev);
if (ret) if (ret)
goto err_free; goto err_stop;
return 0; return 0;
err_stop:
hid_hw_stop(hdev);
err_free: err_free:
kfree(drv_data); kfree(drv_data);
return ret; return ret;
...@@ -863,8 +866,7 @@ static void lg_remove(struct hid_device *hdev) ...@@ -863,8 +866,7 @@ static void lg_remove(struct hid_device *hdev)
struct lg_drv_data *drv_data = hid_get_drvdata(hdev); struct lg_drv_data *drv_data = hid_get_drvdata(hdev);
if (drv_data->quirks & LG_FF4) if (drv_data->quirks & LG_FF4)
lg4ff_deinit(hdev); lg4ff_deinit(hdev);
else hid_hw_stop(hdev);
hid_hw_stop(hdev);
kfree(drv_data); kfree(drv_data);
} }
......
...@@ -1477,7 +1477,6 @@ int lg4ff_deinit(struct hid_device *hid) ...@@ -1477,7 +1477,6 @@ int lg4ff_deinit(struct hid_device *hid)
} }
} }
#endif #endif
hid_hw_stop(hid);
drv_data->device_props = NULL; drv_data->device_props = NULL;
kfree(entry); kfree(entry);
......
...@@ -1734,14 +1734,14 @@ static int logi_dj_probe(struct hid_device *hdev, ...@@ -1734,14 +1734,14 @@ static int logi_dj_probe(struct hid_device *hdev,
if (retval < 0) { if (retval < 0) {
hid_err(hdev, "%s: logi_dj_recv_query_paired_devices error:%d\n", hid_err(hdev, "%s: logi_dj_recv_query_paired_devices error:%d\n",
__func__, retval); __func__, retval);
goto logi_dj_recv_query_paired_devices_failed; /*
* This can happen with a KVM, let the probe succeed,
* logi_dj_recv_queue_unknown_work will retry later.
*/
} }
} }
return retval; return 0;
logi_dj_recv_query_paired_devices_failed:
hid_hw_close(hdev);
llopen_failed: llopen_failed:
switch_to_dj_mode_fail: switch_to_dj_mode_fail:
......
...@@ -551,10 +551,14 @@ static void pcmidi_setup_extra_keys( ...@@ -551,10 +551,14 @@ static void pcmidi_setup_extra_keys(
static int pcmidi_set_operational(struct pcmidi_snd *pm) static int pcmidi_set_operational(struct pcmidi_snd *pm)
{ {
int rc;
if (pm->ifnum != 1) if (pm->ifnum != 1)
return 0; /* only set up ONCE for interace 1 */ return 0; /* only set up ONCE for interace 1 */
pcmidi_get_output_report(pm); rc = pcmidi_get_output_report(pm);
if (rc < 0)
return rc;
pcmidi_submit_output_report(pm, 0xc1); pcmidi_submit_output_report(pm, 0xc1);
return 0; return 0;
} }
...@@ -683,7 +687,11 @@ static int pcmidi_snd_initialise(struct pcmidi_snd *pm) ...@@ -683,7 +687,11 @@ static int pcmidi_snd_initialise(struct pcmidi_snd *pm)
spin_lock_init(&pm->rawmidi_in_lock); spin_lock_init(&pm->rawmidi_in_lock);
init_sustain_timers(pm); init_sustain_timers(pm);
pcmidi_set_operational(pm); err = pcmidi_set_operational(pm);
if (err < 0) {
pk_error("failed to find output report\n");
goto fail_register;
}
/* register it */ /* register it */
err = snd_card_register(card); err = snd_card_register(card);
......
...@@ -2811,7 +2811,6 @@ static int sony_input_configured(struct hid_device *hdev, ...@@ -2811,7 +2811,6 @@ static int sony_input_configured(struct hid_device *hdev,
sony_cancel_work_sync(sc); sony_cancel_work_sync(sc);
sony_remove_dev_list(sc); sony_remove_dev_list(sc);
sony_release_device_id(sc); sony_release_device_id(sc);
hid_hw_stop(hdev);
return ret; return ret;
} }
...@@ -2876,6 +2875,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) ...@@ -2876,6 +2875,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
*/ */
if (!(hdev->claimed & HID_CLAIMED_INPUT)) { if (!(hdev->claimed & HID_CLAIMED_INPUT)) {
hid_err(hdev, "failed to claim input\n"); hid_err(hdev, "failed to claim input\n");
hid_hw_stop(hdev);
return -ENODEV; return -ENODEV;
} }
......
...@@ -370,7 +370,7 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd, ...@@ -370,7 +370,7 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd,
mutex_lock(&minors_lock); mutex_lock(&minors_lock);
dev = hidraw_table[minor]; dev = hidraw_table[minor];
if (!dev) { if (!dev || !dev->exist) {
ret = -ENODEV; ret = -ENODEV;
goto out; goto out;
} }
......
...@@ -169,9 +169,7 @@ static const struct i2c_hid_quirks { ...@@ -169,9 +169,7 @@ static const struct i2c_hid_quirks {
__u16 idProduct; __u16 idProduct;
__u32 quirks; __u32 quirks;
} i2c_hid_quirks[] = { } i2c_hid_quirks[] = {
{ USB_VENDOR_ID_WEIDA, USB_DEVICE_ID_WEIDA_8752, { USB_VENDOR_ID_WEIDA, HID_ANY_ID,
I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV },
{ USB_VENDOR_ID_WEIDA, USB_DEVICE_ID_WEIDA_8755,
I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV }, I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV },
{ I2C_VENDOR_ID_HANTICK, I2C_PRODUCT_ID_HANTICK_5288, { I2C_VENDOR_ID_HANTICK, I2C_PRODUCT_ID_HANTICK_5288,
I2C_HID_QUIRK_NO_IRQ_AFTER_RESET | I2C_HID_QUIRK_NO_IRQ_AFTER_RESET |
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment