From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6EAC29DB6C for ; Mon, 22 Jun 2026 16:16:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782145013; cv=none; b=fGuPyl4OzYv+jxZLo2n6VCLDxjM2abOUiQusrK3XyxaHDNMaD5llr8FB//LW7jfTgcESB4YULNLvTsDG8t1vS7tnFOazidAwTb4OUJGIuXEhywS+Z4lvHhpj1pqS93OcJny+dyxJfJ9ATZSenweh5I5gbJvITY9ag6fWWXDMdsA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782145013; c=relaxed/simple; bh=yJcllB74eIjca8TFI82rE3EwRf8FjWl7B9m34uEES7I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mFrwRYtFaK6OV/8bkt0+ZitO4iuPoQBG1nrHsek0LVztjiTFyx7CcQ2jQfsOvMWi2rSEwrhJfjIjBp6T93xc/TnyPFXO15eblMpBFpkCQxx+55QNOLuISapIvyljDsKf5mYs+WERAe75enSnS+JRj+H9UkGM+nvYATEOmLpcbXM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KDHBLkTG; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KDHBLkTG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63A4A1F000E9; Mon, 22 Jun 2026 16:16:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1782145012; bh=C/c/ZnFn816x3dYN0EttbOgIrQ9C3fDEkTn38/FB7uY=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=KDHBLkTGnpBq0tBH98rMEFx3nPcKMjBPMCY/Psi7PkEq/zhVqyD4DfYCO6gYN8Ggw eK/e2HlZazzAdAoaJquWQhvvwlqU4TdnsDHcydZEiFilhVi6cjxPX7+9CsuRdc9Epc GXKJhumyMWqRTYrw9qdDIRJs6f1AW60WW3Ej4HrpRP6xw4zsP/tx7rfn0rBSjLJnSB JcZjAC/+5TWOdcItI3sFOoiWPd3VKXoe8h7xUsJR3jl/X1wa6XChtGWbZ4hqqy4QcX nk/6rXM42ia6NkZFnL+L3dPMPCyAlb4/Pe2N9QU5UWr/BIVeQN0V3jBmoyCc4bKzBU +5hb0CUOfvNfg== Date: Mon, 22 Jun 2026 17:16:48 +0100 From: Simon Horman To: Lorenzo Bianconi Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Wayen Yan , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, netdev@vger.kernel.org Subject: Re: [PATCH net v2 2/2] net: airoha: fix netif_set_real_num_tx_queues for sparse QoS channels Message-ID: <20260622161648.GG827683@horms.kernel.org> References: <20260619-airoha-qos-fixes-v2-0-5c43485038f9@kernel.org> <20260619-airoha-qos-fixes-v2-2-5c43485038f9@kernel.org> <20260622123136.GC827683@horms.kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Jun 22, 2026 at 03:11:45PM +0200, Lorenzo Bianconi wrote: > > On Fri, Jun 19, 2026 at 01:37:14PM +0200, Lorenzo Bianconi wrote: > > > airoha_tc_htb_alloc_leaf_queue() assigns queue IDs based on the channel > > > index (opt->qid = AIROHA_NUM_TX_RING + channel), but updates > > > real_num_tx_queues with a simple increment (num_tx_queues + 1). When QoS > > > channels are allocated sparsely (e.g., channels 0 and 3 without 1 and > > > 2), the returned qid can exceed real_num_tx_queues, causing out-of-bounds > > > accesses in the networking stack. > > > For example, allocating channel 0 then channel 3 results in > > > real_num_tx_queues = 34 but qid = 35, which is out of range [0, 34). > > > Fix this by computing real_num_tx_queues based on the highest active > > > channel index rather than using a simple counter, in both the allocation > > > and deletion paths. > > > > > > Fixes: ef1ca9271313b ("net: airoha: Add sched HTB offload support") > > > Signed-off-by: Lorenzo Bianconi > > > > Thanks for the update since v1. > > > > Reviewed-by: Simon Horman > > Hi Simon, > > thx for the review. > > > > > FTR, there is an AI-generated review of this patch on sashiko.dev. > > I do not think that should impede the progress of this patch but > > you may want to consider it in the context of follow-up. > > Even if it is not introduced by this patch, I do not think what is reported > by Sashiko is a real issue since airoha_eth driver implements > ndo_select_queue() callback and the selected queue is always in the range > [0, AIROHA_NUM_TX_RING[. HTB queues (in the range > [AIROHA_NUM_TX_RING, AIROHA_NUM_TX_RING + AIROHA_NUM_QOS_CHANNELS[) are just > 'offloaded' and never used in the TC sw path. Agree? Thanks Lorenzo, I've looked over this more closely with the above in mind and I agree.