summaryrefslogtreecommitdiffstats
path: root/net/core/rtnetlink.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2024-02-22 10:50:08 +0000
committerDavid S. Miller <davem@davemloft.net>2024-02-26 11:46:12 +0000
commite353ea9ce471331c13edffd5977eadd602d1bb80 (patch)
tree31a5794e37547a88bfe9d15ad6770be6bdfdf358 /net/core/rtnetlink.c
parent5f6000aa24b939a8853dbc76642ba3cd12765bd8 (diff)
downloadlinux-stable-e353ea9ce471331c13edffd5977eadd602d1bb80.tar.gz
linux-stable-e353ea9ce471331c13edffd5977eadd602d1bb80.tar.bz2
linux-stable-e353ea9ce471331c13edffd5977eadd602d1bb80.zip
rtnetlink: prepare nla_put_iflink() to run under RCU
We want to be able to run rtnl_fill_ifinfo() under RCU protection instead of RTNL in the future. This patch prepares dev_get_iflink() and nla_put_iflink() to run either with RTNL or RCU held. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/rtnetlink.c')
-rw-r--r--net/core/rtnetlink.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index c54dbe05c4c5..060543fe7919 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1611,10 +1611,10 @@ static int put_master_ifindex(struct sk_buff *skb, struct net_device *dev)
static int nla_put_iflink(struct sk_buff *skb, const struct net_device *dev,
bool force)
{
- int ifindex = dev_get_iflink(dev);
+ int iflink = dev_get_iflink(dev);
- if (force || dev->ifindex != ifindex)
- return nla_put_u32(skb, IFLA_LINK, ifindex);
+ if (force || READ_ONCE(dev->ifindex) != iflink)
+ return nla_put_u32(skb, IFLA_LINK, iflink);
return 0;
}