diff options
author | Daniel Lezcano <dlezcano@fr.ibm.com> | 2008-01-19 02:52:35 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:08:04 -0500 |
commit | 7d460db953d6d205e4c8ecc2017aea1ec22b6c9a (patch) | |
tree | 583358d5d9d936c06fa346929a5851a28c0be444 /net/ipv6 | |
parent | ee63d22b8953fd0dde22f52c0bc17a304ae50403 (diff) |
[IPV6]: Fix ip6_frag ctl
Alexey Dobriyan reported an oops when unsharing the network
indefinitely inside a loop. This is because the ip6_frag is not per
namespace while the ctls are.
That happens at the fragment timer expiration:
inet_frag_secret_rebuild function is called and this one restarts the
timer using the value stored inside the sysctl field.
"mod_timer(&f->secret_timer, now + f->ctl->secret_interval);"
When the network is unshared, ip6_frag.ctl is initialized with the new
sysctl instances, but ip6_frag has only one instance. A race in this
case will appear because f->ctl can be modified during the read access
in the timer callback.
Until the ip6_frag is not per namespace, I discard the assignation to
the ctl field of ip6_frags in ip6_frag_sysctl_init when the network
namespace is not the init net.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/reassembly.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index 5cd0bc693a5f..4dfcddc871ce 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c | |||
@@ -627,6 +627,9 @@ static struct inet6_protocol frag_protocol = | |||
627 | 627 | ||
628 | void ipv6_frag_sysctl_init(struct net *net) | 628 | void ipv6_frag_sysctl_init(struct net *net) |
629 | { | 629 | { |
630 | if (net != &init_net) | ||
631 | return; | ||
632 | |||
630 | ip6_frags.ctl = &net->ipv6.sysctl.frags; | 633 | ip6_frags.ctl = &net->ipv6.sysctl.frags; |
631 | } | 634 | } |
632 | 635 | ||