Commit e550dfb0 authored by Neil Horman's avatar Neil Horman Committed by David S. Miller

ipv6: Fix OOPS in ip6_dst_lookup_tail().

This fixes kernel bugzilla 11469: "TUN with 1024 neighbours:
ip6_dst_lookup_tail NULL crash"

dst->neighbour is not necessarily hooked up at this point
in the processing path, so blindly dereferencing it is
the wrong thing to do.  This NULL check exists in other
similar paths and this case was just an oversight.

Also fix the completely wrong and confusing indentation
here while we're at it.

Based upon a patch by Evgeniy Polyakov.
Signed-off-by: default avatarNeil Horman <nhorman@tuxdriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 225f4005
...@@ -951,7 +951,7 @@ static int ip6_dst_lookup_tail(struct sock *sk, ...@@ -951,7 +951,7 @@ static int ip6_dst_lookup_tail(struct sock *sk,
* dst entry and replace it instead with the * dst entry and replace it instead with the
* dst entry of the nexthop router * dst entry of the nexthop router
*/ */
if (!((*dst)->neighbour->nud_state & NUD_VALID)) { if ((*dst)->neighbour && !((*dst)->neighbour->nud_state & NUD_VALID)) {
struct inet6_ifaddr *ifp; struct inet6_ifaddr *ifp;
struct flowi fl_gw; struct flowi fl_gw;
int redirect; int redirect;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment