Skip to content

Commit dfcc930

Browse files
edumazetgregkh
authored andcommitted
net/sched: sch_fq_pie: annotate data-races in fq_pie_dump_stats()
[ Upstream commit 59b1457 ] fq_codel_dump_stats() acquires the qdisc spinlock a bit too late. Move this acquisition before we fill tc_fq_pie_xstats with live data. Alternative would be to add READ_ONCE() and WRITE_ONCE() annotations, but the spinlock is needed anyway to scan q->new_flows and q->old_flows. Fixes: ec97ecf ("net: sched: add Flow Queue PIE packet scheduler") Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com> Link: https://patch.msgid.link/20260423063527.2568262-1-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent be08d46 commit dfcc930

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

net/sched/sch_fq_pie.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -506,18 +506,19 @@ static int fq_pie_dump(struct Qdisc *sch, struct sk_buff *skb)
506506
static int fq_pie_dump_stats(struct Qdisc *sch, struct gnet_dump *d)
507507
{
508508
struct fq_pie_sched_data *q = qdisc_priv(sch);
509-
struct tc_fq_pie_xstats st = {
510-
.packets_in = q->stats.packets_in,
511-
.overlimit = q->stats.overlimit,
512-
.overmemory = q->overmemory,
513-
.dropped = q->stats.dropped,
514-
.ecn_mark = q->stats.ecn_mark,
515-
.new_flow_count = q->new_flow_count,
516-
.memory_usage = q->memory_usage,
517-
};
509+
struct tc_fq_pie_xstats st = { 0 };
518510
struct list_head *pos;
519511

520512
sch_tree_lock(sch);
513+
514+
st.packets_in = q->stats.packets_in;
515+
st.overlimit = q->stats.overlimit;
516+
st.overmemory = q->overmemory;
517+
st.dropped = q->stats.dropped;
518+
st.ecn_mark = q->stats.ecn_mark;
519+
st.new_flow_count = q->new_flow_count;
520+
st.memory_usage = q->memory_usage;
521+
521522
list_for_each(pos, &q->new_flows)
522523
st.new_flows_len++;
523524

0 commit comments

Comments
 (0)