]> git.baikalelectronics.ru Git - kernel.git/commit
ipv4: fix NULL pointer + success return in route lookup path
authorNeil Horman <nhorman@tuxdriver.com>
Sat, 20 Jun 2009 08:15:16 +0000 (01:15 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 20 Jun 2009 08:15:16 +0000 (01:15 -0700)
commit3a85884adca512499d3fa176e63dbdbdcb2ef4f9
tree02ce26705cbca451b069205069afb0956deb9e04
parent067ecabc3125e2d5c1099a64ed9e30a76373fc81
ipv4: fix NULL pointer + success return in route lookup path

Don't drop route if we're not caching

I recently got a report of an oops on a route lookup.  Maxime was
testing what would happen if route caching was turned off (doing so by setting
making rt_caching always return 0), and found that it triggered an oops.  I
looked at it and found that the problem stemmed from the fact that the route
lookup routines were returning success from their lookup paths (which is good),
but never set the **rp pointer to anything (which is bad).  This happens because
in rt_intern_hash, if rt_caching returns false, we call rt_drop and return 0.
This almost emulates slient success.  What we should be doing is assigning *rp =
rt and _not_ dropping the route.  This way, during slow path lookups, when we
create a new route cache entry, we don't immediately discard it, rather we just
don't add it into the cache hash table, but we let this one lookup use it for
the purpose of this route request.  Maxime has tested and reports it prevents
the oops.  There is still a subsequent routing issue that I'm looking into
further, but I'm confident that, even if its related to this same path, this
patch makes sense to take.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/route.c