[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAVpQUC4yr68uXvTSs+nW4dwrmuyMLJ-s4cgansGT1rpaz_26w@mail.gmail.com>
Date: Fri, 27 Jun 2025 10:57:26 -0700
From: Kuniyuki Iwashima <kuniyu@...gle.com>
To: Eric Dumazet <edumazet@...gle.com>
Cc: "David S . Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>, David Ahern <dsahern@...nel.org>,
netdev@...r.kernel.org, eric.dumazet@...il.com
Subject: Re: [PATCH net-next 06/10] net: dst: add four helpers to annotate
data-races around dst->dev
On Fri, Jun 27, 2025 at 4:25 AM Eric Dumazet <edumazet@...gle.com> wrote:
>
> dst->dev is read locklessly in many contexts,
> and written in dst_dev_put().
>
> Fixing all the races is going to need many changes.
>
> We probably will have to add full RCU protection.
>
> Add three helpers to ease this painful process.
>
> static inline struct net_device *dst_dev(const struct dst_entry *dst)
> {
> return READ_ONCE(dst->dev);
> }
>
> static inline struct net_device *skb_dst_dev(const struct sk_buff *skb)
> {
> return dst_dev(skb_dst(skb));
> }
>
> static inline struct net *skb_dst_dev_net(const struct sk_buff *skb)
> {
> return dev_net(skb_dst_dev(skb));
> }
>
> static inline struct net *skb_dst_dev_net_rcu(const struct sk_buff *skb)
> {
> return dev_net_rcu(skb_dst_dev(skb));
> }
>
> Fixes: 4a6ce2b6f2ec ("net: introduce a new function dst_dev_put()")
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@...gle.com>
Powered by blists - more mailing lists