ip6_rt_gc_elasticity and ip6_rt_gc_min_interval race in rt6_alloc_cow() ?
Subsystems (2)
Hi,
I came across this code in rt6_alloc_cow():
if (rt6_bind_neighbour(rt, rt->dst.dev)) {
struct net *net = dev_net(rt->dst.dev);
int saved_rt_min_interval =
net->ipv6.sysctl.ip6_rt_gc_min_interval;
int saved_rt_elasticity =
net->ipv6.sysctl.ip6_rt_gc_elasticity;
if (attempts-- > 0) {
net->ipv6.sysctl.ip6_rt_gc_elasticity = 1;
net->ipv6.sysctl.ip6_rt_gc_min_interval = 0;
ip6_dst_gc(&net->ipv6.ip6_dst_ops);
net->ipv6.sysctl.ip6_rt_gc_elasticity =
saved_rt_elasticity;
net->ipv6.sysctl.ip6_rt_gc_min_interval =
saved_rt_min_interval;
goto retry;
}
net_warn_ratelimited("Neighbour table overflow\n");
dst_free(&rt->dst);
return NULL;
}I believe there is a race condition in the setting of ip6_rt_gc_elasticity and ip6_rt_gc_min_interval. I have not seen happen, though:
1) a setting made by the user via sysctl while ip6_dst_gc() is running will get lost
2) another instance of rt6_alloc_cow() may save the temporary values in the saved_* variables, making those permanent.
Am I overlooking some synchronization or should I send a patch to fix this?
Thanks,
Signature · 2 lines
Jiri Bohac <[email protected]> SUSE Labs, SUSE CZ
David Miller
maintainerFrom: Jiri Bohac <[email protected]>
Date: Fri, 30 Nov 2012 19:43:36 +0100
Quoted 4 lines
I believe there is a race condition in the setting of
ip6_rt_gc_elasticityandip6_rt_gc_min_interval. I have not seen happen, though:
Quoted 8 lines
1) a setting made by the user via sysctl while
ip6_dst_gc()is running will get lost2) another instance of
rt6_alloc_cow()may save the temporary values in the saved_* variables, making those permanent.Am I overlooking some synchronization or should I send a patch to fix this?
The ipv4 routing cache had the same issue, I really and sincerely doubt this race matters in practice.