]> git.baikalelectronics.ru Git - kernel.git/commit
net: fix NULL dereferences in check_peer_redir()
authorEric Dumazet <eric.dumazet@gmail.com>
Fri, 29 Jul 2011 19:00:53 +0000 (19:00 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 3 Aug 2011 10:34:12 +0000 (03:34 -0700)
commitf0bef1d2e6ca766fca8dfcf0da5db6b1d0a2104d
tree4eeb8075a93520935381a75514f309228e6824c0
parent70be454cf870c3db48a9d2b03b6b49877c162d8a
net: fix NULL dereferences in check_peer_redir()

Gergely Kalman reported crashes in check_peer_redir().

It appears commit edfa3a0877842 (ipv4: Cache learned redirect
information in inetpeer.) added a race, leading to possible NULL ptr
dereference.

Since we can now change dst neighbour, we should make sure a reader can
safely use a neighbour.

Add RCU protection to dst neighbour, and make sure check_peer_redir()
can be called safely by different cpus in parallel.

As neighbours are already freed after one RCU grace period, this patch
should not add typical RCU penalty (cache cold effects)

Many thanks to Gergely for providing a pretty report pointing to the
bug.

Reported-by: Gergely Kalman <synapse@hippy.csoma.elte.hu>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/dst.h
net/ipv4/ip_output.c
net/ipv4/route.c
net/ipv6/addrconf.c
net/ipv6/ip6_fib.c
net/ipv6/ip6_output.c
net/ipv6/route.c