summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorWilliam Wu <william.wu@rock-chips.com>2018-05-21 13:12:00 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-07-08 16:30:46 +0300
commit447294efb995181076c2c34e9c6bee1703c74a9a (patch)
treeb33f55354ff17315feeac24439081cdf45c551c0 /drivers/usb
parente80add5223dda08db1e5453a0ed4bc1175f394e9 (diff)
downloadlinux-447294efb995181076c2c34e9c6bee1703c74a9a.tar.xz
usb: dwc2: fix the incorrect bitmaps for the ports of multi_tt hub
commit 8760675932ddb614e83702117d36ea644050c609 upstream. 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") Cc: <stable@vger.kernel.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Acked-by: Minas Harutyunyan hminas@synopsys.com> Signed-off-by: William Wu <william.wu@rock-chips.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/dwc2/hcd_queue.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c
index 3ae8b1bbaa55..7f51a77bc5cc 100644
--- a/drivers/usb/dwc2/hcd_queue.c
+++ b/drivers/usb/dwc2/hcd_queue.c
@@ -379,7 +379,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;
}