usb: xhci-mtk: allow bandwidth table rollover
authorChunfeng Yun <chunfeng.yun@mediatek.com>
Fri, 27 Aug 2021 03:31:05 +0000 (11:31 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Aug 2021 08:24:51 +0000 (10:24 +0200)
commitb7d509a92bb0216b01f428166be3770d04bbdd87
treeb17de25ecdf47b56bc8d629f2e1760ed1a05badc
parent452d1ea55c3e621dc94ac8b832c5e00feb59aad4
usb: xhci-mtk: allow bandwidth table rollover

xhci-mtk has 64 slots for periodic bandwidth calculations and each
slot represents byte budgets on a microframe. When an endpoint's
allocation sits on the boundary of the table, byte budgets' slot
can be rolled over but the current implementation doesn't.

This patch allows the microframe index rollover and prevent
out-of-bounds array access.

Signed-off-by: Ikjoon Jang <ikjn@chromium.org>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/20210827033105.26595-1-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-mtk-sch.c
drivers/usb/host/xhci-mtk.h