Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1409948imm; Thu, 5 Jul 2018 22:51:04 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcIIvoOcWG/O7zj64xh0mvAzwso6we7ErTe5aFYZAwumY22JnQksumPoVUkL6RLroOWWt7N X-Received: by 2002:a62:5290:: with SMTP id g138-v6mr9335692pfb.46.1530856264811; Thu, 05 Jul 2018 22:51:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530856264; cv=none; d=google.com; s=arc-20160816; b=MiN03GtckFG6QvVkv/8g77b/OmFkh6lHPmL/8mFs1XYqqFguNvKLARjFiQmZ19EBKY kiYgbuJs8M0IlcnzyXDAOPeuDbxZ0zs7BXWlYNz/2fMP4bWJwxk8Hlq3qpeDSf6T886l KXEF1gWcirjqVJJnx1IAZr2u0PKTWPWqp+PGYFPpIt+Yy8clnD1EolGABek4VuD+l0Ni qc/986Gd3CluAPhid/7OF22S9chYPHvHjQY9V9jtskvQdKh2IYAe30Cx/D3o5m5xvzni D5pTWdAlSUQWgGUqhjPn4H3Yx6lZgeBkjHBVH5kZiCbR5E1361d5DncZVp8l2R56WPDB 6W5A== 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=53VVjlFHEfTkChHOa76Ijkm3cbQEn35uXOVKC4KQvLk=; b=obg1WaxG4toCaHmARlZ9T/MOByKaID9shcSXgD3plKuI3TRcE8d5NMG60Vldb7tks5 H4BYjG1GYXNohFzbIhoEn0QhmouR77Lo4Jo24bzNZsMwywNvfoPAhIGY37njFzjSR4U7 aEhFklbrwqAbT7ZB44QVPc3f5dB8UkAnTAd5HztTtMxLtBQU7BRG7uI3F0OsSyOjNs1r KKr/UG32ZSCfbC7WkQ0Fo7hzfoODVNG5ALjzPx6/HMzFLHFIGyDiZVoAuedRkhh58N3v K7I4xMc9u6SKINDsCgSoMMboljCGvLrM2/6XOXHxG7mOjrPsnqtElWMBsAUmNG/Yjcs+ xNBA== 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 a10-v6si7458783pff.304.2018.07.05.22.50.50; Thu, 05 Jul 2018 22:51:04 -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 S933753AbeGFFt6 (ORCPT + 99 others); Fri, 6 Jul 2018 01:49:58 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60416 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933733AbeGFFty (ORCPT ); Fri, 6 Jul 2018 01:49:54 -0400 Received: from localhost (D57D388D.static.ziggozakelijk.nl [213.125.56.141]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 14C9EB14; Fri, 6 Jul 2018 05:49:53 +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.14 04/61] usb: dwc2: fix the incorrect bitmaps for the ports of multi_tt hub Date: Fri, 6 Jul 2018 07:46:28 +0200 Message-Id: <20180706054712.495058304@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180706054712.332416244@linuxfoundation.org> References: <20180706054712.332416244@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.14-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 @@ -379,7 +379,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; }