Skip to contentSkip to conversation

HID: sony: add missing size validation for Rock Band 3 Pro instruments

PATCH Applied Rosalie Wanders 2 participants 2 messages Apr 12 – Apr 28 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: sony: add missing size validation for Rock Band 3 Pro instruments

This commit adds the missing size validation for Rock Band 3 PS3 Pro instruments in sony_raw_event(), this prevents a malicious device from allowing hid-sony to read out of bounds of the provided buffer.

---
 drivers/hid/hid-sony.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-sony.c +1 -1
index 2260d55a17b0..e75246d29e16 100644
@@ -1188,7 +1188,7 @@ static int sony_raw_event(struct hid_device *hdev, struct hid_report *report,
 	/* Rock Band 3 PS3 Pro instruments set rd[24] to 0xE0 when they're
 	 * sending full reports, and 0x02 when only sending navigation.
 	 */
-	if ((sc->quirks & RB3_PRO_INSTRUMENT) && rd[24] == 0x02) {
+	if ((sc->quirks & RB3_PRO_INSTRUMENT) && size >= 25 && rd[24] == 0x02) {
 		/* Only attempt to enable full report every 8 seconds */
 		if (time_after(jiffies, sc->rb3_pro_poke_jiffies)) {
 			sc->rb3_pro_poke_jiffies = jiffies + secs_to_jiffies(8);
Signature · 1 line
2.53.0
maintainer Applied
#1 lore raw
Quoted 3 lines · Rosalie Wanders

This commit adds the missing size validation for Rock Band 3 PS3 Pro instruments in sony_raw_event(), this prevents a malicious device from allowing hid-sony to read out of bounds of the provided buffer.

Applied to hid.git#for-7.1/upstream-fixes, thanks.

Signature · 2 lines
Jiri Kosina
SUSE Labs