Skip to content

Commit da03e50

Browse files
Roderick ColenbranderJiri Kosina
authored andcommitted
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: 2d77474 ("HID: playstation: add DualShock4 bluetooth support.") Reported-by: kernel test robot <[email protected]> Signed-off-by: Roderick Colenbrander <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 54980d3 commit da03e50

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/hid/hid-playstation.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2131,9 +2131,10 @@ static int dualshock4_parse_report(struct ps_device *ps_dev, struct hid_report *
21312131
} else if (hdev->bus == BUS_BLUETOOTH && report->id == DS4_INPUT_REPORT_BT &&
21322132
size == DS4_INPUT_REPORT_BT_SIZE) {
21332133
struct dualshock4_input_report_bt *bt = (struct dualshock4_input_report_bt *)data;
2134+
uint32_t report_crc = get_unaligned_le32(&bt->crc32);
21342135

21352136
/* Last 4 bytes of input report contains CRC. */
2136-
if (!ps_check_crc32(PS_INPUT_CRC32_SEED, data, size - 4, bt->crc32)) {
2137+
if (!ps_check_crc32(PS_INPUT_CRC32_SEED, data, size - 4, report_crc)) {
21372138
hid_err(hdev, "DualShock4 input CRC's check failed\n");
21382139
return -EILSEQ;
21392140
}

0 commit comments

Comments
 (0)