[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230711001426.24422-1-kuniyu@amazon.com>
Date: Mon, 10 Jul 2023 17:14:26 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <pctammela@...atatu.com>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <jhs@...atatu.com>,
<jiri@...nulli.us>, <kuba@...nel.org>, <mysuryan@...co.com>,
<netdev@...r.kernel.org>, <pabeni@...hat.com>, <vijaynsu@...co.com>,
<xiyou.wangcong@...il.com>, <kuniyu@...zon.com>
Subject: Re: [PATCH net] net/sched: make psched_mtu() RTNL-less safe
From: Pedro Tammela <pctammela@...atatu.com>
Date: Mon, 10 Jul 2023 21:04:29 -0300
> Eric Dumazet says[1]:
> ---
I think we shouldn't use `---` here, or the message below will
be dropped while merging.
> 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/
>
> Fixes: d4b36210c2e6 ("net: pkt_sched: PIE AQM scheme")
> Suggested-by: Eric Dumazet <edumazet@...gle.com>
> Signed-off-by: Pedro Tammela <pctammela@...atatu.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
Powered by blists - more mailing lists