Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipv6: Remove setsockopt_needs_rtnl().

We no longer need to hold RTNL for IPv6 socket options.

Let's remove setsockopt_needs_rtnl().

Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20250702230210.3115355-16-kuni1840@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Kuniyuki Iwashima and committed by
Jakub Kicinski
db38443d eb1ac9ff

+2 -11
+2 -11
net/ipv6/ipv6_sockglue.c
··· 117 117 return opt; 118 118 } 119 119 120 - static bool setsockopt_needs_rtnl(int optname) 121 - { 122 - return false; 123 - } 124 - 125 120 static int copy_group_source_from_sockptr(struct group_source_req *greqs, 126 121 sockptr_t optval, int optlen) 127 122 { ··· 375 380 { 376 381 struct ipv6_pinfo *np = inet6_sk(sk); 377 382 struct net *net = sock_net(sk); 378 - int val, valbool; 379 383 int retv = -ENOPROTOOPT; 380 - bool needs_rtnl = setsockopt_needs_rtnl(optname); 384 + int val, valbool; 381 385 382 386 if (sockptr_is_null(optval)) 383 387 val = 0; ··· 541 547 return 0; 542 548 } 543 549 } 544 - if (needs_rtnl) 545 - rtnl_lock(); 550 + 546 551 sockopt_lock_sock(sk); 547 552 548 553 /* Another thread has converted the socket into IPv4 with ··· 947 954 948 955 unlock: 949 956 sockopt_release_sock(sk); 950 - if (needs_rtnl) 951 - rtnl_unlock(); 952 957 953 958 return retv; 954 959