Skip to contentSkip to conversation

patch "usb: dwc2: fix the incorrect bitmaps for the ports of multi_tt hub" added to usb-linus

PATCH [email protected] 1 participant 1 message Jun 25, 2018

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

usb: dwc2: fix the incorrect bitmaps for the ports of multi_tt hub

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

Quoted 1 line

From 8760675932ddb614e83702117d36ea644050c609 Mon Sep 17 00:00:00 2001

From: William Wu <[email protected]>
Date: Mon, 21 May 2018 18:12:00 +0800
Subject: usb: dwc2: fix the incorrect bitmaps for the ports of multi_tt hub

The dwc2_get_ls_map() use ttport to reference into the bitmap if we're on a multi_tt hub. But the bitmaps index from 0 to (hub->maxchild - 1), while the ttport index from 1 to hub->maxchild. This will cause invalid memory access when the number of ttport is hub->maxchild.

Without this patch, I can easily meet a Kernel panic issue if connect a low-speed USB mouse with the max port of FE2.1 multi-tt hub (1a40:0201) on rk3288 platform.

Fixes 9f9f09b048f5 ("usb: dwc2: host: Totally redo the microframe scheduler")
---
 drivers/usb/dwc2/hcd_queue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc2/hcd_queue.c +1 -1
index d7c3d6c776d8..9c55d1addba9 100644
@@ -383,7 +383,7 @@ static unsigned long *dwc2_get_ls_map(struct dwc2_hsotg *hsotg,
 	/* Get the map and adjust if this is a multi_tt hub */
 	map = qh->dwc_tt->periodic_bitmaps;
 	if (qh->dwc_tt->usb_tt->multi)
-		map += DWC2_ELEMENTS_PER_LS_BITMAP * qh->ttport;
+		map += DWC2_ELEMENTS_PER_LS_BITMAP * (qh->ttport - 1);
 
 	return map;
 }
Signature · 1 line
2.18.0