summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPedro Tammela <pctammela@mojatatu.com>2023-07-10 23:16:34 -0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-11 11:33:44 +0200
commit618d60dc742e78aa9b2b9eaa49ce1fae254ea3b6 (patch)
tree58c002f91f82fb817bd36765cc6823873b58934e /include
parent3d1d9e75df181a7ffa9fc122693469424cd50afd (diff)
downloadlinux-stable-618d60dc742e78aa9b2b9eaa49ce1fae254ea3b6.tar.gz
linux-stable-618d60dc742e78aa9b2b9eaa49ce1fae254ea3b6.tar.bz2
linux-stable-618d60dc742e78aa9b2b9eaa49ce1fae254ea3b6.zip
net/sched: make psched_mtu() RTNL-less safe
[ Upstream commit 150e33e62c1fa4af5aaab02776b6c3812711d478 ] 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: d4b36210c2e6 ("net: pkt_sched: PIE AQM scheme") Suggested-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Pedro Tammela <pctammela@mojatatu.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Link: https://lore.kernel.org/r/20230711021634.561598-1-pctammela@mojatatu.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/net/pkt_sched.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 85e059d3bc23..7b6024f2d4ea 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -133,7 +133,7 @@ extern const struct nla_policy rtm_tca_policy[TCA_MAX + 1];
*/
static inline unsigned int psched_mtu(const struct net_device *dev)
{
- return dev->mtu + dev->hard_header_len;
+ return READ_ONCE(dev->mtu) + dev->hard_header_len;
}
static inline bool is_classid_clsact_ingress(u32 classid)