diff options
author | David S. Miller <davem@davemloft.net> | 2011-03-09 22:55:25 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-09 22:55:25 -0500 |
commit | 7343ff31ebf01691ea4515d3126467434b9d22d6 (patch) | |
tree | 13c8180b8aeb82363c1e7b576372c23fa2d5f955 /net/ipv6/route.c | |
parent | 03a14ab134f4811ab1475f07b1305ccaf38b690f (diff) |
ipv6: Don't create clones of host routes.
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=29252
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=30462
In commit d80bc0fd262ef840ed4e82593ad6416fa1ba3fc4 ("ipv6: Always
clone offlink routes.") we forced the kernel to always clone offlink
routes.
The reason we do that is to make sure we never bind an inetpeer to a
prefixed route.
The logic turned on here has existed in the tree for many years,
but was always off due to a protecting CPP define. So perhaps
it's no surprise that there is a logic bug here.
The problem is that we canot clone a route that is already a
host route (ie. has DST_HOST set). Because if we do, an identical
entry already exists in the routing tree and therefore the
ip6_rt_ins() call is going to fail.
This sets off a series of failures and high cpu usage, because when
ip6_rt_ins() fails we loop retrying this operation a few times in
order to handle a race between two threads trying to clone and insert
the same host route at the same time.
Fix this by simply using the route as-is when DST_HOST is set.
Reported-by: slash@ac.auone-net.jp
Reported-by: Ernst Sjöstrand <ernstp@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r-- | net/ipv6/route.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 904312e25a3c..e7db7014e89f 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -739,8 +739,10 @@ restart: | |||
739 | 739 | ||
740 | if (!rt->rt6i_nexthop && !(rt->rt6i_flags & RTF_NONEXTHOP)) | 740 | if (!rt->rt6i_nexthop && !(rt->rt6i_flags & RTF_NONEXTHOP)) |
741 | nrt = rt6_alloc_cow(rt, &fl->fl6_dst, &fl->fl6_src); | 741 | nrt = rt6_alloc_cow(rt, &fl->fl6_dst, &fl->fl6_src); |
742 | else | 742 | else if (!(rt->dst.flags & DST_HOST)) |
743 | nrt = rt6_alloc_clone(rt, &fl->fl6_dst); | 743 | nrt = rt6_alloc_clone(rt, &fl->fl6_dst); |
744 | else | ||
745 | goto out2; | ||
744 | 746 | ||
745 | dst_release(&rt->dst); | 747 | dst_release(&rt->dst); |
746 | rt = nrt ? : net->ipv6.ip6_null_entry; | 748 | rt = nrt ? : net->ipv6.ip6_null_entry; |