summaryrefslogtreecommitdiff
path: root/drivers/hid/hid-playstation.c
diff options
context:
space:
mode:
authorRoderick Colenbrander <roderick@gaikai.com>2022-11-16 19:00:22 +0300
committerJiri Kosina <jkosina@suse.cz>2022-11-17 02:46:13 +0300
commitda03e502bb22ec859af4f7d1f7d4d5f237b6c3fe (patch)
treeefdb46c01443352e9167ff2bb2e1e523c5930328 /drivers/hid/hid-playstation.c
parent54980d30eff608545884416576416060b80d011e (diff)
downloadlinux-da03e502bb22ec859af4f7d1f7d4d5f237b6c3fe.tar.xz
HID: playstation: fix DualShock4 bluetooth CRC endian issue.
The driver was by accident reading the CRC directly from a hardware structure instead of using get_unaligned_le32. Fixes: 2d77474a2392 ("HID: playstation: add DualShock4 bluetooth support.") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-playstation.c')
-rw-r--r--drivers/hid/hid-playstation.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
index f5e0d06d3cd8..7b5aef538044 100644
--- a/drivers/hid/hid-playstation.c
+++ b/drivers/hid/hid-playstation.c
@@ -2131,9 +2131,10 @@ static int dualshock4_parse_report(struct ps_device *ps_dev, struct hid_report *
} else if (hdev->bus == BUS_BLUETOOTH && report->id == DS4_INPUT_REPORT_BT &&
size == DS4_INPUT_REPORT_BT_SIZE) {
struct dualshock4_input_report_bt *bt = (struct dualshock4_input_report_bt *)data;
+ uint32_t report_crc = get_unaligned_le32(&bt->crc32);
/* Last 4 bytes of input report contains CRC. */
- if (!ps_check_crc32(PS_INPUT_CRC32_SEED, data, size - 4, bt->crc32)) {
+ if (!ps_check_crc32(PS_INPUT_CRC32_SEED, data, size - 4, report_crc)) {
hid_err(hdev, "DualShock4 input CRC's check failed\n");
return -EILSEQ;
}