Skip to content

Commit 638ba50

Browse files
Cong Wangkuba-moo
authored andcommitted
netem: Update sch->q.qlen before qdisc_tree_reduce_backlog()
qdisc_tree_reduce_backlog() notifies parent qdisc only if child qdisc becomes empty, therefore we need to reduce the backlog of the child qdisc before calling it. Otherwise it would miss the opportunity to call cops->qlen_notify(), in the case of DRR, it resulted in UAF since DRR uses ->qlen_notify() to maintain its active list. Fixes: f8d4bc4 ("net/sched: netem: account for backlog updates from child qdisc") Cc: Martin Ottens <martin.ottens@fau.de> Reported-by: Mingi Cho <mincho@theori.io> Signed-off-by: Cong Wang <cong.wang@bytedance.com> Link: https://patch.msgid.link/20250204005841.223511-4-xiyou.wangcong@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 3fe5648 commit 638ba50

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/sched/sch_netem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,9 +749,9 @@ static struct sk_buff *netem_dequeue(struct Qdisc *sch)
749749
if (err != NET_XMIT_SUCCESS) {
750750
if (net_xmit_drop_count(err))
751751
qdisc_qstats_drop(sch);
752-
qdisc_tree_reduce_backlog(sch, 1, pkt_len);
753752
sch->qstats.backlog -= pkt_len;
754753
sch->q.qlen--;
754+
qdisc_tree_reduce_backlog(sch, 1, pkt_len);
755755
}
756756
goto tfifo_dequeue;
757757
}

0 commit comments

Comments
 (0)