Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2010502imm; Tue, 10 Jul 2018 11:32:44 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfcrhO1gZkxlwHIhHYdtFryOz9T//yi25gzyKILFfsq8ToNWGszZg3Te5LBqNlXyRhf/I7Y X-Received: by 2002:a63:1b17:: with SMTP id b23-v6mr23987183pgb.275.1531247564424; Tue, 10 Jul 2018 11:32:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531247564; cv=none; d=google.com; s=arc-20160816; b=ZqmAOghnPZX0IXXJMMJif3rqNc8j8DZNxNDvZprcGYytcd6Pyy7ydHTBR1m2dKM2SS oNVYkSFBLjJNs2C4ElpBIS2sJAmUUke3lVOioCz2Qbc1SxJHouSkAxFOgIUdHPvttPUC IbPfgLCfIkb5CIsXjD1sxnjG8cXPaxSaRQPYf68hEchTev6x0pRzxdL5e2YZG0cCnN1y CCckS+6yss4MPUXnaLO0ZHEKKON3X8KXKBfsf7Z8K7ACUAVwosdFVRDpoIrbKqckyrPc cPJeLAD4rvmOpbc0q55GFhdisjKNtho+8G51mylORvofIbABrANmSByf2YgnPbejVtkH cZzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=nQ2vz+b0kQpS+7qn13F4o6mhgTRvEkMqDlhT8RzPgjs=; b=lTj841LIuYw2jYJKDUUjmlFAMjEdWR0sWblDimtVN5Nzl+aRbbgY9WGs4ImQgvqwN8 EXXiTF6a5hraBYOzHzBhgrBWYj7o040omKS+WQor4NUFtD9uXOD6e7XgfDdTsWGMGL0A +RKXNQZRqNO91eP7nrBZ/87hFhJlXxwWxayONIX3pAPk3+IgqCwtypWR0zUsU/oETLel G9KJ9FMBjpVYh+bg+Hff6MfSl+T3aDG8E+pvTBalgqM9rM/FI0KVx4njmHT+BRz0s3zu +TeR2gdNdBPkYzcqpvXnhP4y5K/oCSEMDzfuw3fV51wYWG53TwIilnjP16Y8wdTlgjtX pAyA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m24-v6si16682021pgl.452.2018.07.10.11.32.29; Tue, 10 Jul 2018 11:32:44 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388124AbeGJSah (ORCPT + 99 others); Tue, 10 Jul 2018 14:30:37 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45604 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733070AbeGJSag (ORCPT ); Tue, 10 Jul 2018 14:30:36 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id CC71EEB4; Tue, 10 Jul 2018 18:30:24 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , William Wu , Felipe Balbi Subject: [PATCH 4.9 04/52] usb: dwc2: fix the incorrect bitmaps for the ports of multi_tt hub Date: Tue, 10 Jul 2018 20:24:32 +0200 Message-Id: <20180710182449.581068549@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710182449.285532226@linuxfoundation.org> References: <20180710182449.285532226@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 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 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: William Wu 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: Reviewed-by: Douglas Anderson Acked-by: Minas Harutyunyan hminas@synopsys.com> Signed-off-by: William Wu Signed-off-by: Felipe Balbi Signed-off-by: Greg Kroah-Hartman --- 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 @@ -479,7 +479,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; }