@@ -1950,9 +1950,7 @@ static void rtmsg_ifa(int event, struct in_ifaddr *ifa, struct nlmsghdr *nlh,
static size_t inet_get_link_af_size(const struct net_device *dev,
u32 ext_filter_mask)
{
- struct in_device *in_dev = rcu_dereference_rtnl(dev->ip_ptr);
-
- if (!in_dev)
+ if (!rcu_access_pointer(dev->ip_ptr))
return 0;
return nla_total_size(IPV4_DEVCONF_MAX * 4); /* IFLA_INET_CONF */
@@ -1961,7 +1959,7 @@ static size_t inet_get_link_af_size(const struct net_device *dev,
static int inet_fill_link_af(struct sk_buff *skb, const struct net_device *dev,
u32 ext_filter_mask)
{
- struct in_device *in_dev = rcu_dereference_rtnl(dev->ip_ptr);
+ struct in_device *in_dev = rcu_dereference(dev->ip_ptr);
struct nlattr *nla;
int i;
Since commit 5fa85a09390c ("net: core: rcu-ify rtnl af_ops"), af_ops->{get_link_af_size,fill_link_af}() are called under RCU. Instead of using rcu_dereference_rtnl(), let's make the context clear by using RCU helpers. Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> --- net/ipv4/devinet.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)