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 17BD2298CC4; Tue, 21 Jul 2026 22:03:42 +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=1784671424; cv=none; b=Z2AACOIfDwNs678CFWMFSjgOwdgDXh/80zvFKXwC11rafEcMhgWogdkyssJUClDbtJb6VOF/vadGTFA2GQYGBAivwcHXyCNQ5Ol43pGCYySjZzHbEa2E53u22dzO9ptq4nbmd43VZgtPVT37AdSU2CRS3KtdjYRSvzhBquLvJ5k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784671424; c=relaxed/simple; bh=lwT41EM1GnziCh4E7eUEdH7aIYebXoZJT77g2jiyTAU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=R09hMc3UV7l/m4CG114uPVm6HjYAoOz6stA0h6A8LTIaWotZXpJS30SvF7omufOdM+hVkLid5lyD4LFs0Yotfx9KYuzoEyTlm5j2tEB++aDiCWN0c7pjKHyNrZdND/IgkZksfAhiX6jwUM/24Vu85hcKtE01bwaCjdlLqZC9/Mw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=iZw3r2VR; 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="iZw3r2VR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78DE11F00A3A; Tue, 21 Jul 2026 22:03:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784671422; bh=FFtzLEvh8wLfnhvYtSZ/WGi2gMSQS9VYBgOwzrSfJgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=iZw3r2VRWSdbGsC9UEMl4B7TvbXjHjYDexL2YauT51xe/guHjYVD+WvwMp/z+FRyf FQrh2Rw6dASpHtqsdi53oyx95gACJ58JZ04gUjFD6oGFFAzphLta45aUvY0+j6+uSr UOpgfb7ReZmFG/Vffj7mbaNLJwZwYeBjQyOiIHgM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eric Dumazet , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 240/843] net/sched: sch_htb: annotate data-races (I) Date: Tue, 21 Jul 2026 17:17:55 +0200 Message-ID: <20260721152411.414992789@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152405.946368001@linuxfoundation.org> References: <20260721152405.946368001@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.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet [ Upstream commit e54c33503bf7cebb1c1790251ce90f1252678081 ] htb_dump() runs without holding qdisc spinlock. Add missing READ_ONCE()/WRITE_ONCE() annotations around q->overlimits and q->direct_pkts. Fixes: edb09eb17ed8 ("net: sched: do not acquire qdisc spinlock in qdisc/class stats dump") Signed-off-by: Eric Dumazet Link: https://patch.msgid.link/20260514095935.3926276-3-edumazet@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/sched/sch_htb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index c704b73a655462..2c73f49740dee4 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c @@ -565,7 +565,7 @@ htb_change_class_mode(struct htb_sched *q, struct htb_class *cl, s64 *diff) if (new_mode == HTB_CANT_SEND) { cl->overlimits++; - q->overlimits++; + WRITE_ONCE(q->overlimits, q->overlimits + 1); } if (cl->prio_activity) { /* not necessary: speed optimization */ @@ -625,7 +625,7 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch, /* enqueue to helper queue */ if (q->direct_queue.qlen < q->direct_qlen) { __qdisc_enqueue_tail(skb, &q->direct_queue); - q->direct_pkts++; + WRITE_ONCE(q->direct_pkts, q->direct_pkts + 1); } else { return qdisc_drop(skb, sch, to_free); } @@ -1229,12 +1229,12 @@ static int htb_dump(struct Qdisc *sch, struct sk_buff *skb) struct nlattr *nest; struct tc_htb_glob gopt; - sch->qstats.overlimits = q->overlimits; + sch->qstats.overlimits = READ_ONCE(q->overlimits); /* Its safe to not acquire qdisc lock. As we hold RTNL, * no change can happen on the qdisc parameters. */ - gopt.direct_pkts = q->direct_pkts; + gopt.direct_pkts = READ_ONCE(q->direct_pkts); gopt.version = HTB_VER; gopt.rate2quantum = q->rate2quantum; gopt.defcls = q->defcls; -- 2.53.0