Skip to content

Commit 7aae016

Browse files
petrpavlugregkh
authored andcommitted
net/ipv6: Fix the RT cache flush via sysctl using a previous delay
[ Upstream commit 14a20e5 ] The net.ipv6.route.flush system parameter takes a value which specifies a delay used during the flush operation for aging exception routes. The written value is however not used in the currently requested flush and instead utilized only in the next one. A problem is that ipv6_sysctl_rtcache_flush() first reads the old value of net->ipv6.sysctl.flush_delay into a local delay variable and then calls proc_dointvec() which actually updates the sysctl based on the provided input. Fix the problem by switching the order of the two operations. Fixes: 4990509 ("[NETNS][IPV6]: Make sysctls route per namespace.") Signed-off-by: Petr Pavlu <[email protected]> Reviewed-by: David Ahern <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 76b34e5 commit 7aae016

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/ipv6/route.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6346,12 +6346,12 @@ static int ipv6_sysctl_rtcache_flush(struct ctl_table *ctl, int write,
63466346
if (!write)
63476347
return -EINVAL;
63486348

6349-
net = (struct net *)ctl->extra1;
6350-
delay = net->ipv6.sysctl.flush_delay;
63516349
ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
63526350
if (ret)
63536351
return ret;
63546352

6353+
net = (struct net *)ctl->extra1;
6354+
delay = net->ipv6.sysctl.flush_delay;
63556355
fib6_run_gc(delay <= 0 ? 0 : (unsigned long)delay, net, delay > 0);
63566356
return 0;
63576357
}

0 commit comments

Comments
 (0)