Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Junyoung Jang
Thu, 26 Nov 2026 14:11
[PATCH net] net/sched: sch_choke: fix skb leak on packet ring wrap
Author: Junyoung Jang
Date: Thu, 26 Nov 2026 14:11
Date: Thu, 26 Nov 2026 14:11
57 lines
13155 bytes
13155 bytes
CHOKe represents an empty ring with q->head == q->tail. When
choke_drop_by_idx() drops a matched packet from the middle of the ring,
it clears q->tab[idx] and decrements sch->q.qlen without reducing
choke_len(q).
Repeated interior drops allow choke_len(q) to reach q->tab_mask while
sch->q.qlen is still below q->limit. Enqueuing another packet then
advances q->tail onto q->head with live skbs still in q->tab.
Once wrapped, choke_dequeue() and choke_reset() see an empty ring,
stalling dequeue and leaking all queued skbs on qdisc reset or deletion.
If sch->q.qlen is still below q->limit after the wrap, subsequent
choke_enqueue() calls also overwrite live q->tab entries in place,
leaking skbs during normal packet processing.
Check choke_len(q) < q->tab_mask in choke_enqueue() to preserve an empty
slot and prevent the ring from wrapping.
An in-house LLM-based analysis tool developed by the authors
assisted in surfacing this bug candidate and drafting the initial notes.
Root-cause analysis, patch code, and reproducer results were manually
reviewed and independently verified by the authors.
Fixes: 45e144339ac5 ("sched: CHOKe flow scheduler")
Co-developed-by: Gwanhyun Lee <gwanhyunlee@gmail.com>
Signed-off-by: Gwanhyun Lee <gwanhyunlee@gmail.com>
Signed-off-by: Junyoung Jang <graypanda.inzag@gmail.com>
---
Tested on net/main in QEMU with a C reproducer that fills a 4,095-packet
CHOKe ring (tab_mask = 4095), triggers one interior matched drop, and
sends one more packet:
- Before: q->tail wrapped onto q->head, and deleting the qdisc freed
none of the 4,095 queued skbs (traced via kfree_skb).
- After: the extra packet hit pdrops, and deleting the qdisc freed all
4,094 remaining skbs.
net/sched/sch_choke.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c
index 73d3e673dc7b..92d4f29acf57 100644
--- a/net/sched/sch_choke.c
+++ b/net/sched/sch_choke.c
@@ -268,7 +268,7 @@ static int choke_enqueue(struct sk_buff *skb, struct Qdisc *sch,
}
/* Admit new packet */
- if (sch->q.qlen < q->limit) {
+ if (sch->q.qlen < q->limit && choke_len(q) < q->tab_mask) {
q->tab[q->tail] = skb;
q->tail = (q->tail + 1) & q->tab_mask;
qdisc_qlen_inc(sch);
base-commit: ae8e5ef9fa9eeaf4ee0a9a9bde0fc63023d9b154
--
2.43.0
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads