Eric Dumazet f886497212 ipv4: fix dst race in sk_dst_get()
When IP route cache had been removed in linux-3.6, we broke assumption
that dst entries were all freed after rcu grace period. DST_NOCACHE
dst were supposed to be freed from dst_release(). But it appears
we want to keep such dst around, either in UDP sockets or tunnels.

In sk_dst_get() we need to make sure dst refcount is not 0
before incrementing it, or else we might end up freeing a dst
twice.

DST_NOCACHE set on a dst does not mean this dst can not be attached
to a socket or a tunnel.

Then, before actual freeing, we need to observe a rcu grace period
to make sure all other cpus can catch the fact the dst is no longer
usable.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Dormando <dormando@rydia.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-06-25 17:41:44 -07:00
..
2014-06-04 22:46:38 -07:00
2014-05-18 21:10:29 -04:00
2014-06-04 22:46:38 -07:00
2014-06-02 11:00:41 -07:00
2013-12-29 16:34:25 -05:00
2013-10-08 23:19:24 -04:00
2014-05-12 14:03:41 -04:00
2014-06-02 11:00:41 -07:00
2014-06-25 17:41:44 -07:00
2014-06-02 11:00:41 -07:00
2014-02-25 07:04:16 +01:00
2014-02-19 11:41:25 +01:00
2014-05-07 16:06:05 -04:00
2014-06-02 11:00:41 -07:00
2014-06-02 11:00:41 -07:00
2014-06-05 00:49:51 -07:00
2014-06-04 22:46:38 -07:00
2014-05-23 16:28:53 -04:00