net: airoha: Fix skb->priority underflow in
Subsystems (4)
PATCH v2 1/1 net: airoha: Fix skb->priority underflow in
From b894fc031e307f1b6756ea9fcac98e82e23815e1 Mon Sep 17 00:00:00 2001
From: "Wayen.Yan" <[email protected]>
Date: Sun, 14 Jun 2026 07:30:54 +0800
Subject: [PATCH net v2] net: airoha: Fix skb->priority underflow in
airoha_dev_select_queue()
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.).
Fix by guarding the subtraction: when priority is 0, map to queue 0 (lowest priority), otherwise apply the original (priority - 1) % 8 mapping.
--- drivers/net/ethernet/airoha/airoha_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/airoha/airoha_eth.c +1 -1
@@ -1933,7 +1933,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 ? (skb->priority -1 ) %AIROHA_NUM_QOS_QUEUES :0 ; queue = channel *AIROHA_NUM_QOS_QUEUES + queue;return queue < dev->num_tx_queues ? queue :0 ;
Signature · 1 line
2.51.0
Quoted 21 lines · Wayen Yan
From
b894fc031e307f1b6756ea9fcac98e82e23815e1Mon Sep 17 00:00:00 2001
From: "Wayen.Yan" <[email protected]>
Date: Sun, 14 Jun 2026 07:30:54 +0800
Subject: [PATCH net v2] net: airoha: Fixskb->priorityunderflow in
airoha_dev_select_queue()In
airoha_dev_select_queue(), the expression:queue = (skb->priority - 1) % AIROHA_NUM_QOS_QUEUES;implicitly converts to unsigned arithmetic: when
skb->priorityis 0 (the default for unclassified traffic), (0u - 1u) wraps toUINT_MAX, andUINT_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.).Fix by guarding the subtraction: when priority is 0, map to queue 0 (lowest priority), otherwise apply the original (priority - 1) % 8 mapping.
Quoted 6 lines
Fixes 2b288b81560b ("net: airoha: Introduce ndo_select_queue callback")Acked-by Lorenzo Bianconi <[email protected]>Signed-off-by Wayen <[email protected]>--- drivers/net/ethernet/airoha/airoha_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Hm, I tried to apply this patch to my tree just to see what would happen with the duplicated SMTP headers and it looks like they just get added to the commit message.
I think you might need to re-send it (but you'll have to wait 24 hours between re-sends).
The code looks fine to me, though, so feel free to include my tag: