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