* [PATCH v2 net] net/sched: make psched_mtu() RTNL-less safe
@ 2023-07-11 2:16 Pedro Tammela
2023-07-12 11:48 ` Simon Horman
2023-07-12 23:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Pedro Tammela @ 2023-07-11 2:16 UTC (permalink / raw)
To: netdev
Cc: jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni, Pedro Tammela
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>
---
include/net/pkt_sched.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index e98aac9d5ad5..15960564e0c3 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -134,7 +134,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 struct net *qdisc_net(struct Qdisc *q)
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 net] net/sched: make psched_mtu() RTNL-less safe
2023-07-11 2:16 [PATCH v2 net] net/sched: make psched_mtu() RTNL-less safe Pedro Tammela
@ 2023-07-12 11:48 ` Simon Horman
2023-07-12 23:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2023-07-12 11:48 UTC (permalink / raw)
To: Pedro Tammela
Cc: netdev, jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni
On Mon, Jul 10, 2023 at 11:16:34PM -0300, Pedro Tammela wrote:
> 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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 net] net/sched: make psched_mtu() RTNL-less safe
2023-07-11 2:16 [PATCH v2 net] net/sched: make psched_mtu() RTNL-less safe Pedro Tammela
2023-07-12 11:48 ` Simon Horman
@ 2023-07-12 23:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-07-12 23:20 UTC (permalink / raw)
To: Pedro Tammela
Cc: netdev, jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 10 Jul 2023 23:16:34 -0300 you wrote:
> 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.
> -------
>
> [...]
Here is the summary with links:
- [v2,net] net/sched: make psched_mtu() RTNL-less safe
https://git.kernel.org/netdev/net/c/150e33e62c1f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-12 23:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-11 2:16 [PATCH v2 net] net/sched: make psched_mtu() RTNL-less safe Pedro Tammela
2023-07-12 11:48 ` Simon Horman
2023-07-12 23:20 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.