]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
HID: sony: Workaround for DS4 dongle hotplug kernel crash.
authorRoderick Colenbrander <roderick.colenbrander@sony.com>
Thu, 15 Jul 2021 19:30:33 +0000 (13:30 -0600)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 13 Aug 2021 07:47:06 +0000 (09:47 +0200)
commit6c4d91df70f1095404de0472ff9895dab110081e
tree5c732cb1dce699c3ec4dd05c2675752431cb450b
parent319423704db0cf98ab2e0b36af1548195b2e0094
HID: sony: Workaround for DS4 dongle hotplug kernel crash.

The hid-sony driver has custom DS4 connect/disconnect logic for the
DS4 dongle, which is a USB dongle acting as a proxy to Bluetooth
connected DS4.

The connect/disconnect logic works fine generally, however not in
conjunction with Steam. Steam implements its own DS4 driver using
hidraw. Both hid-sony and Steam are issuing their own HID requests
and are racing each other during DS4 dongle connect/disconnect
resulting in a kernel crash in hid-sony.

The problem is that upon a DS4 connect to the dongle, hid-sony kicks
of 'ds4_get_calibration_data' from within its dongle hotplug code.
The calibration code issues raw HID feature report for reportID 0x02.
When Steam is running, it issues a feature report for reportID 0x12
typically just prior to hid-sony requesting feature reportID 0x02.
The result is that 'ds4_get_calibration_data' receives the data Steam
requested as that's the HID report returing first. Currently this
results in it processing invalid data, which ultimately results in a
divide by zero upon a future 'dualshock4_parse_report'.

The solution for now is to check within 'ds4_get_calibration_data' to
check if we received data for the feature report we issued and if not
retry. This fixes bug 206785.

BugLink: https://bugs.launchpad.net/bugs/1935846
Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
(cherry picked from commit f5dc93b7875bcb8be77baa792cc9432aaf65365b)
Signed-off-by: Alex Hung <alex.hung@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/hid/hid-sony.c