mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-04 04:02:26 +00:00
HID: sony: fix error path in probe
When the setup of the GHL fails, we are not calling hid_hw_stop(). This leads to the hidraw node not being released, meaning a crash whenever somebody attempts to open the file. Cc: stable@vger.kernel.org Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20211202095334.14399-2-benjamin.tissoires@redhat.com
This commit is contained in:
parent
f237d9028f
commit
7998193bcc
@ -3037,19 +3037,23 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
||||
*/
|
||||
if (!(hdev->claimed & HID_CLAIMED_INPUT)) {
|
||||
hid_err(hdev, "failed to claim input\n");
|
||||
hid_hw_stop(hdev);
|
||||
return -ENODEV;
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (sc->quirks & (GHL_GUITAR_PS3WIIU | GHL_GUITAR_PS4)) {
|
||||
if (!hid_is_usb(hdev))
|
||||
return -EINVAL;
|
||||
if (!hid_is_usb(hdev)) {
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
usbdev = to_usb_device(sc->hdev->dev.parent->parent);
|
||||
|
||||
sc->ghl_urb = usb_alloc_urb(0, GFP_ATOMIC);
|
||||
if (!sc->ghl_urb)
|
||||
return -ENOMEM;
|
||||
if (!sc->ghl_urb) {
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (sc->quirks & GHL_GUITAR_PS3WIIU)
|
||||
ret = ghl_init_urb(sc, usbdev, ghl_ps3wiiu_magic_data,
|
||||
@ -3059,7 +3063,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
||||
ARRAY_SIZE(ghl_ps4_magic_data));
|
||||
if (ret) {
|
||||
hid_err(hdev, "error preparing URB\n");
|
||||
return ret;
|
||||
goto err;
|
||||
}
|
||||
|
||||
timer_setup(&sc->ghl_poke_timer, ghl_magic_poke, 0);
|
||||
@ -3068,6 +3072,10 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
err:
|
||||
hid_hw_stop(hdev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void sony_remove(struct hid_device *hdev)
|
||||
|
Loading…
Reference in New Issue
Block a user