diff mbox series

[v1,net-next,1/2] ipv4: Use RCU helper in inet_get_link_af_size() and inet_fill_link_af().

Message ID 20240815211137.62280-2-kuniyu@amazon.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net: Clean up af_ops->{get_link_af_size,fill_link_af}(). | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 29 this patch: 29
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/build_clang success Errors and warnings before: 29 this patch: 29
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 29 this patch: 29
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 18 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 1 this patch: 1
netdev/source_inline success Was 0 now: 0
netdev/contest fail net-next-2024-08-16--00-00 (tests: 706)

Commit Message

Kuniyuki Iwashima Aug. 15, 2024, 9:11 p.m. UTC
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(-)
diff mbox series

Patch

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 61be85154dd1..a4f9822213bf 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -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;