Skip to content

Commit dc56c30

Browse files
edumazetgregkh
authored andcommitted
net/sched: sch_htb: do not change sch->flags in htb_dump()
[ Upstream commit 9b949fa ] htb_dump() runs without holding qdisc spinlock. It is illegal to touch sch->flags with non locked RMW, as concurrent readers might see intermediate wrong values. Set TCQ_F_OFFLOADED in control path (htb_init()) instead. Fixes: d03b195 ("sch_htb: Hierarchical QoS hardware offload") Signed-off-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20260514095935.3926276-2-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e9c1d78 commit dc56c30

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

net/sched/sch_htb.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,7 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt,
11481148
* parts (especially calling ndo_setup_tc) on errors.
11491149
*/
11501150
q->offload = true;
1151+
sch->flags |= TCQ_F_OFFLOADED;
11511152

11521153
return 0;
11531154
}
@@ -1208,11 +1209,6 @@ static int htb_dump(struct Qdisc *sch, struct sk_buff *skb)
12081209
struct nlattr *nest;
12091210
struct tc_htb_glob gopt;
12101211

1211-
if (q->offload)
1212-
sch->flags |= TCQ_F_OFFLOADED;
1213-
else
1214-
sch->flags &= ~TCQ_F_OFFLOADED;
1215-
12161212
sch->qstats.overlimits = q->overlimits;
12171213
/* Its safe to not acquire qdisc lock. As we hold RTNL,
12181214
* no change can happen on the qdisc parameters.

0 commit comments

Comments
 (0)