diff mbox series

[v1,net-next] arp: Convert SIOCDARP and SIOCSARP to per-netns RTNL.

Message ID 20250211045057.10419-1-kuniyu@amazon.com (mailing list archive)
State Accepted
Commit 7aca0d8a727da503a8adeb6866a136ded5bea4b1
Delegated to: Netdev Maintainers
Headers show
Series [v1,net-next] arp: Convert SIOCDARP and SIOCSARP to per-netns RTNL. | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
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: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 2 this patch: 2
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: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 28 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-02-11--15-00 (tests: 889)

Commit Message

Kuniyuki Iwashima Feb. 11, 2025, 4:50 a.m. UTC
ioctl(SIOCDARP/SIOCSARP) operates on a single netns fetched from
an AF_INET socket in inet_ioctl().

Let's hold rtnl_net_lock() for SIOCDARP and SIOCSARP.

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
 net/ipv4/arp.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Eric Dumazet Feb. 11, 2025, 1:30 p.m. UTC | #1
On Tue, Feb 11, 2025 at 5:51 AM Kuniyuki Iwashima <kuniyu@amazon.com> wrote:
>
> ioctl(SIOCDARP/SIOCSARP) operates on a single netns fetched from
> an AF_INET socket in inet_ioctl().
>
> Let's hold rtnl_net_lock() for SIOCDARP and SIOCSARP.
>
> Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>

Reviewed-by: Eric Dumazet <edumazet@google.com>
patchwork-bot+netdevbpf@kernel.org Feb. 13, 2025, 10:50 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Tue, 11 Feb 2025 13:50:57 +0900 you wrote:
> ioctl(SIOCDARP/SIOCSARP) operates on a single netns fetched from
> an AF_INET socket in inet_ioctl().
> 
> Let's hold rtnl_net_lock() for SIOCDARP and SIOCSARP.
> 
> Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
> 
> [...]

Here is the summary with links:
  - [v1,net-next] arp: Convert SIOCDARP and SIOCSARP to per-netns RTNL.
    https://git.kernel.org/netdev/net-next/c/7aca0d8a727d

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index cb9a7ed8abd3..431d900c136c 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -1062,8 +1062,8 @@  static int arp_req_set_proxy(struct net *net, struct net_device *dev, int on)
 		IPV4_DEVCONF_ALL(net, PROXY_ARP) = on;
 		return 0;
 	}
-	if (__in_dev_get_rtnl(dev)) {
-		IN_DEV_CONF_SET(__in_dev_get_rtnl(dev), PROXY_ARP, on);
+	if (__in_dev_get_rtnl_net(dev)) {
+		IN_DEV_CONF_SET(__in_dev_get_rtnl_net(dev), PROXY_ARP, on);
 		return 0;
 	}
 	return -ENXIO;
@@ -1293,14 +1293,14 @@  int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg)
 
 	switch (cmd) {
 	case SIOCDARP:
-		rtnl_lock();
+		rtnl_net_lock(net);
 		err = arp_req_delete(net, &r);
-		rtnl_unlock();
+		rtnl_net_unlock(net);
 		break;
 	case SIOCSARP:
-		rtnl_lock();
+		rtnl_net_lock(net);
 		err = arp_req_set(net, &r);
-		rtnl_unlock();
+		rtnl_net_unlock(net);
 		break;
 	case SIOCGARP:
 		rcu_read_lock();