Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp895425imm; Mon, 21 May 2018 16:43:40 -0700 (PDT) X-Google-Smtp-Source: AB8JxZomkRC54nw53FO6nJI3IXhVoA4/cYoRw6E0Ga+DAZSIYhCpo7c/32Sxoq/qrFaK2ETLE4Cs X-Received: by 2002:a17:902:7c18:: with SMTP id x24-v6mr22826578pll.173.1526946220672; Mon, 21 May 2018 16:43:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526946220; cv=none; d=google.com; s=arc-20160816; b=qveVXrXraPmn1fRYMdzORH/Vo1UIH7gzIAV2LinmnfQc77GM+kje+2yCZMO43zj2rb qWBicPhsDGrvjtn9B/Lsmjlm8D0CKMVL0HMn5CtreH8pQ4+n4ciT/xlYxWv0PYe4Aukc 7ydYfV/L4XomWng12zrkyG1i0E2nRVh/eBOWelc4vwtMZ3DubdDHJOb22LsQo3WSaL6u aSYtM3mfXxZda80VzZJ0knY+DODPNhotvCUIduhJz4NJbGwucEFikc7Bhp5zB+nI1C25 P0F1MKqxrQpohTgRl88tGoant4IVAtGPFy9zkdiQPJRtgNrlOKrNPoYEUesDqq2da8Bb C/Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=litGZRhl6jc7qObR6wGkJNcT2DrgoLy922VfLNpaGiE=; b=trPwAnBa8OL9bL0TW0I59a4276OAFT1443LGlZ+6HFpVoEfgQsTfgyq9h9nTtj1QYs 77/yl71KPU6Gmrl/TfqCNTo48d81kZojvxa+1fXU1OnLBmNFONy4BXMO9ZMRNpEuVUlR E6b7XxdY5S7IaJYiIG6iw5rFNcky1KZApWAZjmazVkVNYxGD3OvjHzui/YKZiX6URkIv eVZ8TUBBs5pLtC3iqLXPT83Ti8+POJcyKeb6pdRdM5CkR6gliFd0fL2+E5KvRFoLqnac S2xE40ds5b6HX6yWzKWXLD/9L1obM3WsYVVwhtBGGDrw6HzT2ph3jbZygw+Vn2Ndy7Nk /9RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=WjEtW6Mc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h10-v6si14810035pll.425.2018.05.21.16.43.25; Mon, 21 May 2018 16:43:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=WjEtW6Mc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751921AbeEUXl4 (ORCPT + 99 others); Mon, 21 May 2018 19:41:56 -0400 Received: from mail-ua0-f196.google.com ([209.85.217.196]:45704 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751870AbeEUXly (ORCPT ); Mon, 21 May 2018 19:41:54 -0400 Received: by mail-ua0-f196.google.com with SMTP id j5-v6so11058269uak.12 for ; Mon, 21 May 2018 16:41:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=litGZRhl6jc7qObR6wGkJNcT2DrgoLy922VfLNpaGiE=; b=WjEtW6McbJN1xRLETWcBFOk5eiv8qDhRReIG5qQqZghdPbaT1WUNjydkY20EjgjBUM /MtZJ8U2mx64Xec6U6Fcg0a/qZbTWr8E/fL3D4jGXPuAL+v9MXJI8WMavpLnjgSM1A0t CWgWrU8mqRgLcOYtGM5/P/Vjf2EXhdnBMRc316ZH3TDF66AZi8bmCTnu2b3oMbO3Fkk0 gnO+arIcj0kTJ4AOPNONEryVwH2S3gwY5qyPWL+j55yfEwJuXr9DEtox8vhWBloQPLiO r4fPQF+DLqOr0RLN1rH28CtNOgpwGWlbZXGuvOU/gkPBZy5ButGiRLh2DQPdE51hhqsE faJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=litGZRhl6jc7qObR6wGkJNcT2DrgoLy922VfLNpaGiE=; b=UvDo3JxE0cjiiPAFDnct3tGwET6SkLbcBwJaYe7LYNz/OUvKJ9Wk0l5VyTE0uvtCdl 8NR89InzVqzLGzcEegUDfzgkVmC0fBWPgqg5JJWBvrLrsrZt+BnaW6lKKxEJyRbP0CiI ojuodQCpZWPOJkQRuHEttTVIITqUYVsBJquzM4Lug17F+lXv6i+cBE6iHas71nawsIic ENrnhIJE0RYymx1735qKP+WaJ6UbhhDxyll1/q72PI58O+oraXAk31EbCcKQHiEPbb/c Vts72RDB0xc6XtNl+Hlyhzmc+N2iZqEE96MEhyKImM53atixo9F9OcWLbZNSmY2tRWm0 hOZA== X-Gm-Message-State: ALKqPwekb+w21sMMJoRxLEaxj1XM+RRKxXqYIL/TqmL3bhP+EMmIINPw NoGqDakMPxxnza/y0ZnQQubk4p2Cyv+wor6+ipcvPw== X-Received: by 2002:ab0:4987:: with SMTP id e7-v6mr16201223uad.20.1526946113214; Mon, 21 May 2018 16:41:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.48.82 with HTTP; Mon, 21 May 2018 16:41:52 -0700 (PDT) In-Reply-To: <1526897520-9340-1-git-send-email-william.wu@rock-chips.com> References: <1526897520-9340-1-git-send-email-william.wu@rock-chips.com> From: Doug Anderson Date: Mon, 21 May 2018 16:41:52 -0700 Message-ID: Subject: Re: [PATCH] usb: dwc2: fix the incorrect bitmaps for the ports of multi_tt hub To: William Wu Cc: hminas@synopsys.com, felipe.balbi@linux.intel.com, Greg Kroah-Hartman , Sergei Shtylyov , =?UTF-8?Q?Heiko_St=C3=BCbner?= , LKML , linux-usb@vger.kernel.org, "open list:ARM/Rockchip SoC..." , Frank Wang , =?UTF-8?B?6buE5rab?= , "daniel.meng" , John Youn , fml@rock-chips.com, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Mon, May 21, 2018 at 3:12 AM, William Wu wrote: > 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. > > Signed-off-by: William Wu > --- > drivers/usb/dwc2/hcd_queue.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c > index d7c3d6c..9c55d1a 100644 > --- 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(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); Oops, thanks for the fix. Fixes: 9f9f09b048f5 ("usb: dwc2: host: Totally redo the microframe scheduler") Cc: stable@vger.kernel.org Reviewed-by: Douglas Anderson -Doug