Skip to content

Commit a0f50c7

Browse files
edumazetgregkh
authored andcommitted
net/sched: sch_fq_codel: remove data-races from fq_codel_dump_stats()
[ Upstream commit bbfaa73 ] 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: edb09eb ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 6e3b984 commit a0f50c7

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

net/sched/sch_fq_codel.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,8 @@ static int fq_codel_dump_stats(struct Qdisc *sch, struct gnet_dump *d)
581581
};
582582
struct list_head *pos;
583583

584+
sch_tree_lock(sch);
585+
584586
st.qdisc_stats.maxpacket = q->cstats.maxpacket;
585587
st.qdisc_stats.drop_overlimit = q->drop_overlimit;
586588
st.qdisc_stats.ecn_mark = q->cstats.ecn_mark;
@@ -589,7 +591,6 @@ static int fq_codel_dump_stats(struct Qdisc *sch, struct gnet_dump *d)
589591
st.qdisc_stats.memory_usage = q->memory_usage;
590592
st.qdisc_stats.drop_overmemory = q->drop_overmemory;
591593

592-
sch_tree_lock(sch);
593594
list_for_each(pos, &q->new_flows)
594595
st.qdisc_stats.new_flows_len++;
595596

0 commit comments

Comments
 (0)