Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3469348imm; Tue, 29 May 2018 07:47:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpW4KZZguK0ruhA8CU+yiHj/ZKKR0/5o4jNFqTvAQ4cAxJ3HdlV6oPdHweYHzeq6BIdvmCJ X-Received: by 2002:a62:860b:: with SMTP id x11-v6mr17652545pfd.92.1527605261441; Tue, 29 May 2018 07:47:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527605261; cv=none; d=google.com; s=arc-20160816; b=w5GU7oSxdUElShCx83b0yuuFsGgE/py7V5UGEOp98IHhq5Jf5zzg+kCOnb6DgZUIza ImXEp3eJDF0JtbPMgpexIpCtvCN54W/5/do2tO8tQjDYfZg1ViI4p2RtAsnqVKQBCo8E xuC31bG7EhvDv4fPxOaSqcCsKaU3qohIYuDDBX0iuHwHYwX2DufmkP/dfVSaIQdiUNTY 0rj1GHZSC72Awc8NFAjzsj+Lyw7hwUAf1hLsOjnq6dA0nRYTjlMF8gloiGP68yVwicLA 7JrOwRfPXC6HQ041o5tAvoXA2WItMgJqv+cn5eWTOa2h9vRXEvb2bicSoAchq3C59ohs E6Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:references:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=K4Zg1OtNYduSVe2c7E2JfccRKl1Vbrj8F9PtTgBeuiY=; b=K9ym6eAQ5t/tQwSVFwG/Y6GSKEzrGKAlueCAlObLVr0tv9iYkZNwKnLtxOc+Fm1TxJ yAOhcm6gJljIIhGG5sxXLqFysV1Kc7S4fFTxxRHTSkQhE7VQ7/hUjaFCkwm1C/Sb5FmF CL4M6uzBjKXLQ9QhQuCvr36JB6wTKhEdPRSJwDJvdi073I7d9tymwjBnRd51EpNHtsNn YB/ifuTKcCaEIFNaMpssmL5WV9GyJ72xvvmGr7Q5iIH38w32nIianzNBukBeu5UlBwpX 1uW0xdlWDtV24IrTJafMaBUlcYFyBDwX/Lxw/UHO2l7fpv8O3cI7nRbqmG1UviLz7tTI gR/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=aIaiFmYS; 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=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e26-v6si31972200pfn.244.2018.05.29.07.47.27; Tue, 29 May 2018 07:47:41 -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=@synopsys.com header.s=mail header.b=aIaiFmYS; 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=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935514AbeE2Op3 (ORCPT + 99 others); Tue, 29 May 2018 10:45:29 -0400 Received: from smtprelay.synopsys.com ([198.182.37.59]:56033 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935287AbeE2OpW (ORCPT ); Tue, 29 May 2018 10:45:22 -0400 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id D25FA1E05C2; Tue, 29 May 2018 16:45:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1527605121; bh=zHMNK5eLGpPKo2kZRCFep/L0iuqJ0tapBRTErexWhNU=; h=From:To:CC:Subject:Date:References:From; b=aIaiFmYS4VzHD24o4H/TfT2ZFwPZyRFbT9+R3d1tf6DQ/bwbKF7rhrfo132mhDI4a Y7KFiUGuFxqDZIIKFzntZu8tzL1AdNpnv5X5kDavOu+Ytk4F/nxh3JcVucK4wTOk0+ XVB/c/wz3s9BERabMAAaZ1J4VrnQHLD1fpRXnx/+Hu3qozUQJCb+xCg1/PNFvm+3IT T+STT9yqFygfAlfEBE2V3asD5zdeOr3YIeOqeuFUTgYnKf2hSoPrDkzFFS9H2B1Dmx 8RWIfzZvTCmq4E9O+WKn1jZlLy/ZTIhGNV+rSAWnl5v1mInEV9o/LTe+8sYatRcRsT cUSNSZq3iDCJw== Received: from US01WEHTC3.internal.synopsys.com (us01wehtc3.internal.synopsys.com [10.15.84.232]) by mailhost.synopsys.com (Postfix) with ESMTP id 8439D5129; Tue, 29 May 2018 07:45:19 -0700 (PDT) Received: from AM04WEHTCA.internal.synopsys.com (10.116.16.190) by US01WEHTC3.internal.synopsys.com (10.15.84.232) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 29 May 2018 07:45:14 -0700 Received: from AM04WEMBXA.internal.synopsys.com ([fe80::79c3:55f2:1f20:5bf4]) by am04wehtca.internal.synopsys.com ([::1]) with mapi id 14.03.0361.001; Tue, 29 May 2018 18:45:11 +0400 From: Minas Harutyunyan To: William Wu , "Minas.Harutyunyan@synopsys.com" , "felipe.balbi@linux.intel.com" , "gregkh@linuxfoundation.org" CC: "sergei.shtylyov@cogentembedded.com" , "heiko@sntech.de" , "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" , "linux-rockchip@lists.infradead.org" , "frank.wang@rock-chips.com" , "huangtao@rock-chips.com" , "dianders@google.com" , "daniel.meng@rock-chips.com" , "John.Youn@synopsys.com" , "fml@rock-chips.com" Subject: Re: [PATCH] usb: dwc2: fix the incorrect bitmaps for the ports of multi_tt hub Thread-Topic: [PATCH] usb: dwc2: fix the incorrect bitmaps for the ports of multi_tt hub Thread-Index: AQHT8OxXMtSRTMYeG0CT9CelkWDIlA== Date: Tue, 29 May 2018 14:45:10 +0000 Message-ID: <410670D7E743164D87FA6160E7907A56013135A5A0@am04wembxa.internal.synopsys.com> References: <1526897520-9340-1-git-send-email-william.wu@rock-chips.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.116.70.165] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Acked-by Minas Harutyunyan hminas@synopsys.com>=0A= =0A= On 5/21/2018 2:13 PM, William Wu wrote:=0A= > The dwc2_get_ls_map() use ttport to reference into the=0A= > bitmap if we're on a multi_tt hub. But the bitmaps index=0A= > from 0 to (hub->maxchild - 1), while the ttport index from=0A= > 1 to hub->maxchild. This will cause invalid memory access=0A= > when the number of ttport is hub->maxchild.=0A= > =0A= > Without this patch, I can easily meet a Kernel panic issue=0A= > if connect a low-speed USB mouse with the max port of FE2.1=0A= > multi-tt hub (1a40:0201) on rk3288 platform.=0A= > =0A= > Signed-off-by: William Wu =0A= > ---=0A= > drivers/usb/dwc2/hcd_queue.c | 2 +-=0A= > 1 file changed, 1 insertion(+), 1 deletion(-)=0A= > =0A= > diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c= =0A= > index d7c3d6c..9c55d1a 100644=0A= > --- a/drivers/usb/dwc2/hcd_queue.c=0A= > +++ b/drivers/usb/dwc2/hcd_queue.c=0A= > @@ -383,7 +383,7 @@ static unsigned long *dwc2_get_ls_map(struct dwc2_hso= tg *hsotg,=0A= > /* Get the map and adjust if this is a multi_tt hub */=0A= > map =3D qh->dwc_tt->periodic_bitmaps;=0A= > if (qh->dwc_tt->usb_tt->multi)=0A= > - map +=3D DWC2_ELEMENTS_PER_LS_BITMAP * qh->ttport;=0A= > + map +=3D DWC2_ELEMENTS_PER_LS_BITMAP * (qh->ttport - 1);=0A= > =0A= > return map;=0A= > }=0A= > =0A= =0A=