lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240815211137.62280-2-kuniyu@amazon.com>
Date: Thu, 15 Aug 2024 14:11:36 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
	<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
	<pabeni@...hat.com>, David Ahern <dsahern@...nel.org>, Roopa Prabhu
	<roopa@...dia.com>, Nikolay Aleksandrov <razor@...ckwall.org>
CC: Kuniyuki Iwashima <kuniyu@...zon.com>, Kuniyuki Iwashima
	<kuni1840@...il.com>, <netdev@...r.kernel.org>
Subject: [PATCH v1 net-next 1/2] ipv4: Use RCU helper in inet_get_link_af_size() and inet_fill_link_af().

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@...zon.com>
---
 net/ipv4/devinet.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

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;
 
-- 
2.30.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ