Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1427041imm; Thu, 5 Jul 2018 23:14:35 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfkxYbVYuYLocGnybaX2KwFpdu7rCqsnQQfZrkXgcVGy+3USTJmkMzk1DVdTfwnjpC3wd51 X-Received: by 2002:a17:902:7782:: with SMTP id o2-v6mr9047874pll.93.1530857675852; Thu, 05 Jul 2018 23:14:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530857675; cv=none; d=google.com; s=arc-20160816; b=g1/MHg5IyhwVkXGdX4PqtMNbJo9w4MN8HWof2akq+jeHuQ+MaHEwisbwKma6ahWKNe wXAQz8GpzmRvaSivLqqiGdMl4p13Xn3sMTwf1/PCg/CbgqzMhtNvu9yXYHPUBFckQxjf /lQsVZgSXE6bJ4pem5S0DpaCCku6+vpZeeMb72Bmj08tLmIBe6GuM2+A3V9smYrlMWjR hOFFHITLTt8kMcPW7IJ3L+dNg/pd4sKYqV5p9HzvQUsukjQLHt+vBIKZvIDSrEaS3IcL 0IqisN6UMUQHzuD6q8glQ/Iw5J/Jct4uAHKfX1SiOsxqRvCUayH8gDYpb2wLVSoXS9gJ hrxQ== 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=35ewbxnZaT4UllUDESsZNE/9MyHqpwiLC/4my5aQOnY=; b=OpYIVS/YjDNzpTvHDPJo50LvpJfDzcdJcW359t2+MoDAS/hK7YuZzr/qqLBE7N7HGC 9ZvBeS94mDLgHdjdUm0kJzUVVSq9c3qbtXad5HcmjRAiTOEdCYiYhvlUGBFMLWOQqtUd bH0rlRkfYkWiiTKybR4wGW7SG26mHsD0kH/1qfrDIjTsG9zKXMxxLFpNh37jiLsKnP20 qjLwtj298YJ2gRM+li75O6cdykFjp9GIuCFVz+6SfXWAJgK5W8j7VHzFn2OQIraFKo78 l3+Is5xlHaPuoiBLkr6FoEwXmGP3X9WmM7wpqaTrITgFMuwdzLxu2IFLBtAtJqT9/Xy6 APAg== 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 y20-v6si6167932pga.89.2018.07.05.23.14.21; Thu, 05 Jul 2018 23:14:35 -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 S932823AbeGFFrd (ORCPT + 99 others); Fri, 6 Jul 2018 01:47:33 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58556 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932265AbeGFFra (ORCPT ); Fri, 6 Jul 2018 01:47:30 -0400 Received: from localhost (D57D388D.static.ziggozakelijk.nl [213.125.56.141]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id E0C35B14; Fri, 6 Jul 2018 05:47:29 +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.17 04/46] usb: dwc2: fix the incorrect bitmaps for the ports of multi_tt hub Date: Fri, 6 Jul 2018 07:46:25 +0200 Message-Id: <20180706054524.825002981@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180706054524.595521988@linuxfoundation.org> References: <20180706054524.595521988@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.17-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 @@ -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; }