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 A50AA43E06E; Thu, 30 Jul 2026 14:17:39 +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=1785421061; cv=none; b=IvVBjAt0RIXMLYljbuZdBH0tMMej1BdPuK6jl+7URukU/gmjHdZ6B7e6aPujAOmPhTJvbF5bSR7YQkpZYcTj4MWuV5/yj3l/gi5HD5nTrAkCCEP6Ty64VOiOSNYBtgTZCzO9dwaWEMnFCkINJjKNOMjEJ0ABX2JZ7ponvpcNa4k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785421061; c=relaxed/simple; bh=Blpj8UVtrdS4qQQpij23k8W/GiO9CL7jAzS9LgB35es=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ItusppG2oIRLz3xrKV8d3W85S9gYemWfd6+VYI+wiy6bADY5ox3/uwjQfFwlRisydhX7BsO1BzKEObEixtRIBbErWpdEuPdi8//zct1zDHmcKoCcZRVHR+ZOSgxHlWUHPqunFHl7ij3BgJDgNjc1fSqrWwfgDDv+U0ADqnJFeqY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=OM9fFdOr; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="OM9fFdOr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 972071F000E9; Thu, 30 Jul 2026 14:17:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785421059; bh=4hvyP9UhOezFJvfsn3O3bpJxiu85PZzBv8T5h1HZUxM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=OM9fFdOr57MSKFTEXu/TOODSAC7jSTnqTuwouQndThe90fV28KntOIAnW2npDbOyc HwlqgX4bCRfDZflvEn7JqSHzBi6Iuk60W0EiXEN1nJkdicioQcXKFbCPI9KNdEjdO7 qbtxiJ86/cD80k4zDAcYwl28qIycjnEPTRM2mRLk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Lorenzo Bianconi , Joe Damato , Wayen Yan , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12 003/602] net: airoha: Fix skb->priority underflow in airoha_dev_select_queue() Date: Thu, 30 Jul 2026 16:06:35 +0200 Message-ID: <20260730141436.060470754@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260730141435.976815864@linuxfoundation.org> References: <20260730141435.976815864@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wayen Yan [ Upstream commit 86e51aa24686cc95bb35613059e8b94b9b81e3f0 ] In airoha_dev_select_queue(), the expression: queue = (skb->priority - 1) % AIROHA_NUM_QOS_QUEUES; implicitly converts to unsigned arithmetic: when skb->priority is 0 (the default for unclassified traffic), (0u - 1u) wraps to UINT_MAX, and UINT_MAX % 8 = 7, routing default best-effort packets to the highest-priority QoS queue. This causes QoS inversion where the majority of traffic on a PON gateway starves actual high-priority flows (VoIP, gaming, etc.). The "- 1" offset was a leftover from the ETS offload implementation that has since been removed. The correct mapping is a direct modulo: queue = skb->priority % AIROHA_NUM_QOS_QUEUES; This maps priority 0 → queue 0 (lowest), priority 7 → queue 7 (highest), with higher priorities wrapping around. This is the standard Linux sk_prio → HW queue mapping used by other drivers. Fixes: 2b288b81560b ("net: airoha: Introduce ndo_select_queue callback") Link: https://lore.kernel.org/netdev/178185573207.2378135.3729126358670287878@gmail.com/ Acked-by: Lorenzo Bianconi Reviewed-by: Joe Damato Signed-off-by: Wayen Yan Link: https://patch.msgid.link/178194366700.2485734.5368768965976693502@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/airoha/airoha_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c index 07f89e08b5faad..db4b87c17a2864 100644 --- a/drivers/net/ethernet/airoha/airoha_eth.c +++ b/drivers/net/ethernet/airoha/airoha_eth.c @@ -2505,7 +2505,7 @@ static u16 airoha_dev_select_queue(struct net_device *dev, struct sk_buff *skb, */ channel = netdev_uses_dsa(dev) ? skb_get_queue_mapping(skb) : port->id; channel = channel % AIROHA_NUM_QOS_CHANNELS; - queue = (skb->priority - 1) % AIROHA_NUM_QOS_QUEUES; /* QoS queue */ + queue = skb->priority % AIROHA_NUM_QOS_QUEUES; queue = channel * AIROHA_NUM_QOS_QUEUES + queue; return queue < dev->num_tx_queues ? queue : 0; -- 2.53.0