aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorEric Dumazet2024-02-28 13:54:36 +0000
committerDavid S. Miller2024-03-01 08:42:32 +0000
commit45b90ec9a214ff7fbde8190126301a07387c46e5 (patch)
treee532d2682cb1701c812c0185c811d0c54ce146b2 /net
parent624d5aec487cf8c2955d9c5880685714f7fe8e6f (diff)
ipv6: addrconf_disable_policy() optimization
Writing over /proc/sys/net/ipv6/conf/default/disable_policy does not need to hold RTNL. Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/addrconf.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 44340ff82da5..0e7135a206b0 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -6693,20 +6693,19 @@ void addrconf_disable_policy_idev(struct inet6_dev *idev, int val)
static
int addrconf_disable_policy(struct ctl_table *ctl, int *valp, int val)
{
+ struct net *net = (struct net *)ctl->extra2;
struct inet6_dev *idev;
- struct net *net;
+
+ if (valp == &net->ipv6.devconf_dflt->disable_policy) {
+ WRITE_ONCE(*valp, val);
+ return 0;
+ }
if (!rtnl_trylock())
return restart_syscall();
WRITE_ONCE(*valp, val);
- net = (struct net *)ctl->extra2;
- if (valp == &net->ipv6.devconf_dflt->disable_policy) {
- rtnl_unlock();
- return 0;
- }
-
if (valp == &net->ipv6.devconf_all->disable_policy) {
struct net_device *dev;