HID: playstation: sanity check DualShock4 calibration data.
authorRoderick Colenbrander <roderick@gaikai.com>
Fri, 6 Jan 2023 01:59:07 +0000 (17:59 -0800)
committerJiri Kosina <jkosina@suse.cz>
Wed, 18 Jan 2023 09:10:27 +0000 (10:10 +0100)
commit74cb485f68eb3dff6802ee446a602607b03f4fc9
treec06d2f46e8f98bbeb2697e9fbf503877ab28f9df
parentfebb2c0d7c69c0396aa32d5ab425a4163473961a
HID: playstation: sanity check DualShock4 calibration data.

Some DualShock4 devices report invalid calibration data resulting
in kernel oopses due to division by zero during report handling.

The devices affected generally appear to be clone devices, which don't
implement all reports properly and don't populate proper calibration
data. The issue may have been seen on an official device with erased
calibration reports.

This patch prevents the crashes by essentially disabling calibration
when invalid values are detected.

Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
Tested-by: Alain Carlucci <alain.carlucci@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-playstation.c