diff options
author | Eric Dumazet <edumazet@google.com> | 2024-05-03 21:20:59 +0200 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2024-05-07 11:14:50 +0200 |
commit | 9cf621bd5fcbeadc2804951d13d487e22e95b363 (patch) | |
tree | 04a9eea4366aa75be0d1011dbe90e04ded85a3ad /net/core | |
parent | rtnetlink: do not depend on RTNL in rtnl_xdp_prog_skb() (diff) | |
download | linux-9cf621bd5fcbeadc2804951d13d487e22e95b363.tar.xz linux-9cf621bd5fcbeadc2804951d13d487e22e95b363.zip |
rtnetlink: allow rtnl_fill_link_netnsid() to run under RCU protection
We want to be able to run rtnl_fill_ifinfo() under RCU protection
instead of RTNL in the future.
All rtnl_link_ops->get_link_net() methods already using dev_net()
are ready. I added READ_ONCE() annotations on others.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/rtnetlink.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 41eb8bca5305..af8da8aeed39 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -1923,9 +1923,6 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, goto nla_put_failure; } - if (rtnl_fill_link_netnsid(skb, dev, src_net, gfp)) - goto nla_put_failure; - if (new_nsid && nla_put_s32(skb, IFLA_NEW_NETNSID, *new_nsid) < 0) goto nla_put_failure; @@ -1938,6 +1935,8 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, goto nla_put_failure; rcu_read_lock(); + if (rtnl_fill_link_netnsid(skb, dev, src_net, GFP_ATOMIC)) + goto nla_put_failure_rcu; qdisc = rcu_dereference(dev->qdisc); if (qdisc && nla_put_string(skb, IFLA_QDISC, qdisc->ops->id)) goto nla_put_failure_rcu; |