]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net/sched: sch_fq_codel: remove data-races from fq_codel_dump_stats()
authorEric Dumazet <edumazet@google.com>
Tue, 21 Apr 2026 14:25:09 +0000 (14:25 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 23 Apr 2026 04:12:50 +0000 (21:12 -0700)
fq_codel_dump_stats() acquires the qdisc spinlock a bit too late.

Move this acquisition before we fill st.qdisc_stats with live data.

Fixes: edb09eb17ed8 ("net: sched: do not acquire qdisc spinlock in qdisc/class stats dump")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
Link: https://patch.msgid.link/20260421142509.3967231-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/sched/sch_fq_codel.c

index 2a3d758f67ab43d17128442fd8b51c6ba7775d52..0664b2f2d6f28041e5250a44fc92311116ae0cf1 100644 (file)
@@ -585,6 +585,8 @@ static int fq_codel_dump_stats(struct Qdisc *sch, struct gnet_dump *d)
        };
        struct list_head *pos;
 
+       sch_tree_lock(sch);
+
        st.qdisc_stats.maxpacket = q->cstats.maxpacket;
        st.qdisc_stats.drop_overlimit = q->drop_overlimit;
        st.qdisc_stats.ecn_mark = q->cstats.ecn_mark;
@@ -593,7 +595,6 @@ static int fq_codel_dump_stats(struct Qdisc *sch, struct gnet_dump *d)
        st.qdisc_stats.memory_usage  = q->memory_usage;
        st.qdisc_stats.drop_overmemory = q->drop_overmemory;
 
-       sch_tree_lock(sch);
        list_for_each(pos, &q->new_flows)
                st.qdisc_stats.new_flows_len++;