From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50E9823B61B; Sat, 30 May 2026 18:45:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780166704; cv=none; b=C5M3Lwy1/0Bkg2qDR+Cqd9x8KV70ESE/XtTP3D9pfGOkyCMM4Mw3EGdkhpW6a+KsLJ1PgdbvfcZikKwh3ybqj/qsfvV/duOqn0HaJkrGEYRpLYxeDH4XyL4qjxb8fPz+G7cQFolIV+NtrCxjsF9Co66foIeda1tDhmX5tsw7qpE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780166704; c=relaxed/simple; bh=yJyjeGXHGIQPg17D9KdyLxGaKSGB7nGHiXiirRGMj4A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H1kEPiT86AEtSpHAXHDZQcPrcIzUkAu66WtlqgJ52IFFXm54KmayIFMwL0m0xoFx/ZKU6ErLoxursVezIZeax+ML6/+Cjz6UeeTq2F3u5xjhBbde5kOexPwXWDsY0jMqbSlXNgJutqsaytDW4VsFmUkxAYn/SoCOZAO2/g04B3Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=UJc9hHQZ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="UJc9hHQZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 577B21F00893; Sat, 30 May 2026 18:45:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780166703; bh=6CmJ5FogBxezo+3Vfn+UIXGM4haG6mVBgny4pIMyITw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UJc9hHQZIkbTshfi2+/c52TEHMY0GSHitNUI3tY1xn43bRkKkwzyf+qfssXivWQJA S1F+/u06tyHUjqkmRkoe/FRd7YEd5UyvK/Gk2oe2iQLQqNH6b38gSua/V2umFPJDM4 lV+z30M8SdFlJbQ39SLQaU8cwBFfAdUmBxGNnyII= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eric Dumazet , Jamal Hadi Salim , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 446/589] net/sched: sch_fq_codel: remove data-races from fq_codel_dump_stats() Date: Sat, 30 May 2026 18:05:27 +0200 Message-ID: <20260530160236.421131258@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160224.570625122@linuxfoundation.org> References: <20260530160224.570625122@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet [ Upstream commit bbfaa73ea6871db03dc05d7f05f00557a8981f25 ] 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 Reviewed-by: Jamal Hadi Salim Link: https://patch.msgid.link/20260421142509.3967231-1-edumazet@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/sched/sch_fq_codel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c index 3c1efe360defa..10bdc0de394cc 100644 --- a/net/sched/sch_fq_codel.c +++ b/net/sched/sch_fq_codel.c @@ -559,6 +559,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; @@ -567,7 +569,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++; -- 2.53.0