WSL2-Linux-Kernel/net/ipv6
Eric Dumazet 6bd4f355df ipv6: kill sk_dst_lock
While testing the np->opt RCU conversion, I found that UDP/IPv6 was
using a mixture of xchg() and sk_dst_lock to protect concurrent changes
to sk->sk_dst_cache, leading to possible corruptions and crashes.

ip6_sk_dst_lookup_flow() uses sk_dst_check() anyway, so the simplest
way to fix the mess is to remove sk_dst_lock completely, as we did for
IPv4.

__ip6_dst_store() and ip6_dst_store() share same implementation.

sk_setup_caps() being called with socket lock being held or not,
we have to use sk_dst_set() instead of __sk_dst_set()

Note that I had to move the "np->dst_cookie = rt6_get_cookie(rt);"
in ip6_dst_store() before the sk_setup_caps(sk, dst) call.

This is because ip6_dst_store() can be called from process context,
without any lock held.

As soon as the dst is installed in sk->sk_dst_cache, dst can be freed
from another cpu doing a concurrent ip6_dst_store()

Doing the dst dereference before doing the install is needed to make
sure no use after free would trigger.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-12-03 11:32:06 -05:00
..
netfilter ipv6: distinguish frag queues by device for multicast and link-local packets 2015-11-24 16:45:47 -05:00
Kconfig
Makefile
addrconf.c Revert "ipv6: ndisc: inherit metadata dst when creating ndisc requests" 2015-12-01 15:07:59 -05:00
addrconf_core.c
addrlabel.c
af_inet6.c ipv6: kill sk_dst_lock 2015-12-03 11:32:06 -05:00
ah6.c
anycast.c
datagram.c ipv6: add complete rcu protection around np->opt 2015-12-02 23:37:16 -05:00
esp6.c
exthdrs.c ipv6: add complete rcu protection around np->opt 2015-12-02 23:37:16 -05:00
exthdrs_core.c
exthdrs_offload.c
fib6_rules.c ipv6: fix the incorrect return value of throw route 2015-10-23 02:38:18 -07:00
icmp.c ipv6: kill sk_dst_lock 2015-12-03 11:32:06 -05:00
ila.c
inet6_connection_sock.c ipv6: kill sk_dst_lock 2015-12-03 11:32:06 -05:00
inet6_hashtables.c
ip6_checksum.c
ip6_fib.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-10-24 06:54:12 -07:00
ip6_flowlabel.c
ip6_gre.c
ip6_icmp.c
ip6_input.c
ip6_offload.c ipv6: gro: support sit protocol 2015-10-21 19:36:11 -07:00
ip6_offload.h
ip6_output.c ipv6: add defensive check for CHECKSUM_PARTIAL skbs in ip_fragment 2015-11-01 12:01:28 -05:00
ip6_tunnel.c net/ip6_tunnel: fix dst leak 2015-11-18 16:25:01 -05:00
ip6_udp_tunnel.c
ip6_vti.c
ip6mr.c net: ipmr, ip6mr: fix vif/tunnel failure race condition 2015-11-24 17:15:56 -05:00
ipcomp6.c
ipv6_sockglue.c ipv6: add complete rcu protection around np->opt 2015-12-02 23:37:16 -05:00
mcast.c snmp: Remove duplicate OUTMCAST stat increment 2015-11-16 16:36:32 -05:00
mcast_snoop.c
mip6.c
ndisc.c Revert "ipv6: ndisc: inherit metadata dst when creating ndisc requests" 2015-12-01 15:07:59 -05:00
netfilter.c
output_core.c
ping.c
proc.c
protocol.c
raw.c ipv6: add complete rcu protection around np->opt 2015-12-02 23:37:16 -05:00
reassembly.c ipv6: distinguish frag queues by device for multicast and link-local packets 2015-11-24 16:45:47 -05:00
route.c Revert "ipv6: ndisc: inherit metadata dst when creating ndisc requests" 2015-12-01 15:07:59 -05:00
sit.c sit: fix sit0 percpu double allocations 2015-11-02 22:54:45 -05:00
syncookies.c ipv6: add complete rcu protection around np->opt 2015-12-02 23:37:16 -05:00
sysctl_net_ipv6.c
tcp_ipv6.c ipv6: kill sk_dst_lock 2015-12-03 11:32:06 -05:00
tcpv6_offload.c
tunnel6.c ipv6: fix tunnel error handling 2015-11-03 10:52:13 -05:00
udp.c ipv6: add complete rcu protection around np->opt 2015-12-02 23:37:16 -05:00
udp_impl.h
udp_offload.c
udplite.c
xfrm6_input.c
xfrm6_mode_beet.c
xfrm6_mode_ro.c
xfrm6_mode_transport.c
xfrm6_mode_tunnel.c
xfrm6_output.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-10-24 06:54:12 -07:00
xfrm6_policy.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next 2015-10-30 20:51:56 +09:00
xfrm6_protocol.c
xfrm6_state.c
xfrm6_tunnel.c