提交 833a1948 编写于 作者: C Chunfeng Yun 提交者: Jialin Zhang

usb: xhci-mtk: fix issue of out-of-bounds array access

stable inclusion
from stable-v5.10.146
commit f31ea57c1183415b7069853a8a57ec9288dc4aef
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6D0VX

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=f31ea57c1183415b7069853a8a57ec9288dc4aef

--------------------------------

commit de5107f4 upstream.

Bus bandwidth array access is based on esit, increase one
will cause out-of-bounds issue; for example, when esit is
XHCI_MTK_MAX_ESIT, will overstep boundary.

Fixes: 7c986fbc ("usb: xhci-mtk: get the microframe boundary for ESIT")
Cc: <stable@vger.kernel.org>
Reported-by: NStan Lu <stan.lu@mediatek.com>
Signed-off-by: NChunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1629189389-18779-5-git-send-email-chunfeng.yun@mediatek.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NJialin Zhang <zhangjialin11@huawei.com>
Reviewed-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 471e9e20
......@@ -539,10 +539,12 @@ static u32 get_esit_boundary(struct mu3h_sch_ep_info *sch_ep)
u32 boundary = sch_ep->esit;
if (sch_ep->sch_tt) { /* LS/FS with TT */
/* tune for CS */
if (sch_ep->ep_type != ISOC_OUT_EP)
boundary++;
else if (boundary > 1) /* normally esit >= 8 for FS/LS */
/*
* tune for CS, normally esit >= 8 for FS/LS,
* not add one for other types to avoid access array
* out of boundary
*/
if (sch_ep->ep_type == ISOC_OUT_EP && boundary > 1)
boundary--;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册