Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp2529095pxt; Mon, 9 Aug 2021 02:43:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7PO2GXO8m+plRi11WfX7+XQuC3Q/o/ZKOal+PE7fTB3eKiC5hFPlCbQcwj+FVLyhX6z3+ X-Received: by 2002:a92:7f03:: with SMTP id a3mr520154ild.254.1628502235014; Mon, 09 Aug 2021 02:43:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628502235; cv=none; d=google.com; s=arc-20160816; b=AE36gYJG7nTBealrbnMsfS8uI3qGorh1+modWK1O2H03U1kXpmAU1rliSXQVKYnOqW BRoioIdebEhQ3+ShUH/I+CzKoPis+5J1/E5hS54SGBdoHJP9MQ5emoyeoK4XHL1TxgcP l0m3lYaUPferhirJRP81Y8MIYx/JxpTLxUnyH09NifFP81ltBVALfGvDxYjRH6OnKVnC gZ8QZeNY0Kq9xz992AgksLeuwMrWcN+Yq1avZ12b9nL2uz7OBeiuh5ipn57oIoMegpM1 n+zOl9RqmbaDLdTfkKfOtwf4Yfcr0XPcE4Ptd2HVo8wplTEz2GGjkU5+49rGbXA93FQz 56jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=A+KAi3dOJuuXd/Qn6cacTVo6xH3AW7xPjOFYRrz7Uok=; b=USNaRmRywnG8agNk1KcH7OGaSTJw92QZp9W02pVQh4xPJt6XEz6Oi97Nkt7Teawn8F Hlv4UR+ksH7YZr2xGTt5RgqO9a1RzXs2U/WXdrbdsT9EVzPQuCmbFLJmr99ngaSP63ks zzwm4PNHLPJbXsHtL35NETv13IlbFrZck7xap9tM6p85Ubqlq5hoj507LVW+mXTk3ICI Sh+LAFgVVH8Wzw9erMsooCsAWNqqrUXmB2o6mF7EqryTJY7/qogxFwFV30El1tMZORCS 8ucOzWg8+d9HYFsucntdkAewERbfeQcD2hB1qDf2auO95w6mGOuuw3k9QeXRqrXgvdN6 GVdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HymP0PD2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c7si17570142iot.72.2021.08.09.02.43.42; Mon, 09 Aug 2021 02:43:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HymP0PD2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234564AbhHIJmi (ORCPT + 99 others); Mon, 9 Aug 2021 05:42:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234365AbhHIJmh (ORCPT ); Mon, 9 Aug 2021 05:42:37 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68835C061796 for ; Mon, 9 Aug 2021 02:42:16 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id d17so15714514plr.12 for ; Mon, 09 Aug 2021 02:42:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=A+KAi3dOJuuXd/Qn6cacTVo6xH3AW7xPjOFYRrz7Uok=; b=HymP0PD2B0cGVjnMKzIUkUNnIY+q8voQCdep9RSZJP0rhHG+lzU47AL/ksz8la8qDT ROPMbY8e9eOtI20PzVcxAUx7Z2MOEU0oxI5YdRQlekp97dEmylrRvQrzzmpiHwOK2CdZ 0+e/b0xFJgPZRRRdDWQ1rAhnthQkeuCeTmaKQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=A+KAi3dOJuuXd/Qn6cacTVo6xH3AW7xPjOFYRrz7Uok=; b=evQjNtttCo9qMwIIqCBg5iurPIXptIufa9wyqEmmIU7DjoVRFfp6UUARIQQxfmYzZK vXniEU1ewehP5HfMl9vdPeNLiEklRkCDkjdMTwmtSprYyO9f1igys2hjwtFySNqgOabj q9YTsIEt8c2EwRes3Ez/o1d214gKyTHwBfsYvRIK1mpRGtdRXlJC+3xc4/EpfQA3M002 hgkCLepv5XXvULCQirnx2gzUrCYELq0ZVL2NuVbHXh1LGy37f5qlZF3Rv+tdSIAQ23dO ox6f37PvNLz9FNls1uH9W4o1IV3zNLBifA/ioz1o6VxYFLF1oqx1w8UyUSeqRO4tGKpm ZhhA== X-Gm-Message-State: AOAM531pmqwkuaYIfG4vrqRlMDYXzeZ0rkGFVSkx+VJUCOAomyJpwSRy nksT2ZaBjHhpvxGtRaUc/OenIJvzTSZBM0k7vFQ+jg== X-Received: by 2002:a17:90b:102:: with SMTP id p2mr674822pjz.126.1628502135890; Mon, 09 Aug 2021 02:42:15 -0700 (PDT) MIME-Version: 1.0 References: <20210809165904.RFC.1.I5165a4a8da5cac23c9928b1ec3c3a1a7383b7c23@changeid> In-Reply-To: From: Ikjoon Jang Date: Mon, 9 Aug 2021 17:42:05 +0800 Message-ID: Subject: Re: [RFC PATCH] usb: xhci-mtk: handle bandwidth table rollover To: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, Chunfeng Yun , "moderated list:ARM/Mediatek SoC support" , Matthias Brugger , open list , "moderated list:ARM/Mediatek SoC support" , Mathias Nyman Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 9, 2021 at 5:11 PM Greg Kroah-Hartman wrote: > > On Mon, Aug 09, 2021 at 04:59:29PM +0800, Ikjoon Jang wrote: > > xhci-mtk has 64 slots for periodic bandwidth calculations and each > > slot represents byte budgets on a microframe. When an endpoint's > > allocation sits on the boundary of the table, byte budgets' slot > > should be rolled over but the current implementation doesn't. > > > > This patch applies a 6 bits mask to the microframe index to handle > > its rollover 64 slots and prevent out-of-bounds array access. > > > > Signed-off-by: Ikjoon Jang > > --- > > > > drivers/usb/host/xhci-mtk-sch.c | 79 +++++++++------------------------ > > drivers/usb/host/xhci-mtk.h | 1 + > > 2 files changed, 23 insertions(+), 57 deletions(-) > > Why is this "RFC"? What needs to be addressed in this change before it > can be accepted? sorry, I had to mention why this is RFC: I simply don't know about the details of the xhci-mtk internals. It was okay from my tests with mt8173 and I think this will be harmless as this is "better than before". But when I removed get_esit_boundary(), I really have no idea why it was there. I'm wondering if there was another reason of that function other than just preventing out-of-bounds. Maybe chunfeng can answer this? Thanks! > > thanks, > > greg k-h