Skip to content

Commit

Permalink
[IPV6]: Fix ip6_frag ctl
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Daniel Lezcano authored and David S. Miller committed Jan 28, 2008
1 parent ee63d22 commit 7d460db
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/ipv6/reassembly.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,9 @@ static struct inet6_protocol frag_protocol =

void ipv6_frag_sysctl_init(struct net *net)
{
if (net != &init_net)
return;

ip6_frags.ctl = &net->ipv6.sysctl.frags;
}

Expand Down

0 comments on commit 7d460db

Please sign in to comment.