lkml.org 
[lkml]   [2018]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.17 04/46] usb: dwc2: fix the incorrect bitmaps for the ports of multi_tt hub
    Date
    4.17-stable review patch.  If anyone has any objections, please let me know.

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

    From: William Wu <william.wu@rock-chips.com>

    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>

    ---
    drivers/usb/dwc2/hcd_queue.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/drivers/usb/dwc2/hcd_queue.c
    +++ b/drivers/usb/dwc2/hcd_queue.c
    @@ -383,7 +383,7 @@ static unsigned long *dwc2_get_ls_map(st
    /* 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;
    }

    \
     
     \ /
      Last update: 2018-07-06 08:13    [W:2.657 / U:1.164 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site