]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: sched: fix ordering of qlen adjustment
authorLion Ackermann <nnamrec@gmail.com>
Mon, 2 Dec 2024 16:22:57 +0000 (17:22 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Dec 2024 12:52:51 +0000 (13:52 +0100)
commit 5eb7de8cd58e73851cd37ff8d0666517d9926948 upstream.

Changes to sch->q.qlen around qdisc_tree_reduce_backlog() need to happen
_before_ a call to said function because otherwise it may fail to notify
parent qdiscs when the child is about to become empty.

Signed-off-by: Lion Ackermann <nnamrec@gmail.com>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Artem Metla <ametla@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sched/sch_cake.c
net/sched/sch_choke.c

index 73e8caeffd47e6758d4e69f39cf147b0a0562636..eee9ebad35a5ca1b3b5ce5d73b1d1b5fd0ab1973 100644 (file)
@@ -1541,7 +1541,6 @@ static unsigned int cake_drop(struct Qdisc *sch, struct sk_buff **to_free)
        b->backlogs[idx]    -= len;
        b->tin_backlog      -= len;
        sch->qstats.backlog -= len;
-       qdisc_tree_reduce_backlog(sch, 1, len);
 
        flow->dropped++;
        b->tin_dropped++;
@@ -1552,6 +1551,7 @@ static unsigned int cake_drop(struct Qdisc *sch, struct sk_buff **to_free)
 
        __qdisc_drop(skb, to_free);
        sch->q.qlen--;
+       qdisc_tree_reduce_backlog(sch, 1, len);
 
        cake_heapify(q, 0);
 
index 3ac3e5c80b6ffb035181d3270b05d7ce32fa2735..e38cf34287018b7bd4f5abf9dd9728e7326a8531 100644 (file)
@@ -123,10 +123,10 @@ static void choke_drop_by_idx(struct Qdisc *sch, unsigned int idx,
        if (idx == q->tail)
                choke_zap_tail_holes(q);
 
+       --sch->q.qlen;
        qdisc_qstats_backlog_dec(sch, skb);
        qdisc_tree_reduce_backlog(sch, 1, qdisc_pkt_len(skb));
        qdisc_drop(skb, sch, to_free);
-       --sch->q.qlen;
 }
 
 struct choke_skb_cb {