This is a note to let you know that I've just added the patch titled usb: xhci-mtk: fix issue of out-of-bounds array access to the 5.13-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: usb-xhci-mtk-fix-issue-of-out-of-bounds-array-access.patch and it can be found in the queue-5.13 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From de5107f473190538a65aac7edea85209cd5c1a8f Mon Sep 17 00:00:00 2001 From: Chunfeng Yun <chunfeng.yun@xxxxxxxxxxxx> Date: Tue, 17 Aug 2021 16:36:25 +0800 Subject: usb: xhci-mtk: fix issue of out-of-bounds array access From: Chunfeng Yun <chunfeng.yun@xxxxxxxxxxxx> commit de5107f473190538a65aac7edea85209cd5c1a8f 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: 7c986fbc16ae ("usb: xhci-mtk: get the microframe boundary for ESIT") Cc: <stable@xxxxxxxxxxxxxxx> Reported-by: Stan Lu <stan.lu@xxxxxxxxxxxx> Signed-off-by: Chunfeng Yun <chunfeng.yun@xxxxxxxxxxxx> Link: https://lore.kernel.org/r/1629189389-18779-5-git-send-email-chunfeng.yun@xxxxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/usb/host/xhci-mtk-sch.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/drivers/usb/host/xhci-mtk-sch.c +++ b/drivers/usb/host/xhci-mtk-sch.c @@ -590,10 +590,12 @@ static u32 get_esit_boundary(struct mu3h 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--; } Patches currently in stable-queue which might be from chunfeng.yun@xxxxxxxxxxxx are queue-5.13/usb-mtu3-fix-the-wrong-hs-mult-value.patch queue-5.13/usb-cdnsp-fix-the-wrong-mult-value-for-hs-isoc-or-intr.patch queue-5.13/usb-xhci-mtk-fix-issue-of-out-of-bounds-array-access.patch queue-5.13/usb-gadget-tegra-xudc-fix-the-wrong-mult-value-for-hs-isoc-or-intr.patch queue-5.13/usb-mtu3-use-mult-for-hs-isoc-or-intr.patch queue-5.13/usb-mtu3-restore-hs-function-when-set-ss-ssp.patch