Skip to content

Commit 150e33e

Browse files
tammelakuba-moo
authored andcommitted
net/sched: make psched_mtu() RTNL-less safe
Eric Dumazet says[1]: ------- Speaking of psched_mtu(), I see that net/sched/sch_pie.c is using it without holding RTNL, so dev->mtu can be changed underneath. KCSAN could issue a warning. ------- Annotate dev->mtu with READ_ONCE() so KCSAN don't issue a warning. [1] https://lore.kernel.org/all/CANn89iJoJO5VtaJ-2=_d2aOQhb0Xw8iBT_Cxqp2HyuS-zj6azw@mail.gmail.com/ v1 -> v2: Fix commit message Fixes: d4b3621 ("net: pkt_sched: PIE AQM scheme") Suggested-by: Eric Dumazet <[email protected]> Signed-off-by: Pedro Tammela <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 1e9cb76 commit 150e33e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/net/pkt_sched.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ extern const struct nla_policy rtm_tca_policy[TCA_MAX + 1];
134134
*/
135135
static inline unsigned int psched_mtu(const struct net_device *dev)
136136
{
137-
return dev->mtu + dev->hard_header_len;
137+
return READ_ONCE(dev->mtu) + dev->hard_header_len;
138138
}
139139

140140
static inline struct net *qdisc_net(struct Qdisc *q)

0 commit comments

Comments
 (0)