android_kernel_google_msm/include/net
Marcelo Ricardo Leitner 493d6a2da3 sctp: fix ASCONF list handling
commit 2d45a02d0166caf2627fe91897c6ffc3b19514c4 upstream.

->auto_asconf_splist is per namespace and mangled by functions like
sctp_setsockopt_auto_asconf() which doesn't guarantee any serialization.

Also, the call to inet_sk_copy_descendant() was backuping
->auto_asconf_list through the copy but was not honoring
->do_auto_asconf, which could lead to list corruption if it was
different between both sockets.

This commit thus fixes the list handling by using ->addr_wq_lock
spinlock to protect the list. A special handling is done upon socket
creation and destruction for that. Error handlig on sctp_init_sock()
will never return an error after having initialized asconf, so
sctp_destroy_sock() can be called without addrq_wq_lock. The lock now
will be take on sctp_close_sock(), before locking the socket, so we
don't do it in inverse order compared to sctp_addr_wq_timeout_handler().

Instead of taking the lock on sctp_sock_migrate() for copying and
restoring the list values, it's preferred to avoid rewritting it by
implementing sctp_copy_descendant().

Issue was found with a test application that kept flipping sysctl
default_auto_asconf on and off, but one could trigger it by issuing
simultaneous setsockopt() calls on multiple sockets or by
creating/destroying sockets fast enough. This is only triggerable
locally.

Fixes: 9f7d653b67 ("sctp: Add Auto-ASCONF support (core).")
Reported-by: Ji Jianwen <jiji@redhat.com>
Suggested-by: Neil Horman <nhorman@tuxdriver.com>
Suggested-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[lizf: Backported to 3.4:
 - use global spinlock instead of per-namespace lock]
Signed-off-by: Zefan Li <lizefan@huawei.com>
2015-10-22 09:20:04 +08:00
..
9p
bluetooth Bluetooth: Remove unused hci_le_ltk_reply() 2014-07-09 10:51:20 -07:00
caif
irda
iucv
netfilter netfilter: nf_conntrack: reserve two bytes for nf_ct_ext->len 2014-05-18 05:25:55 -07:00
netns
nfc
phonet
sctp sctp: fix ASCONF list handling 2015-10-22 09:20:04 +08:00
tc_act
act_api.h
addrconf.h ipv6,mcast: always hold idev->lock before mca_lock 2013-07-28 16:26:02 -07:00
af_ieee802154.h
af_rxrpc.h
af_unix.h
ah.h
arp.h
atmclip.h
ax25.h
ax88796.h
cfg80211-wext.h
cfg80211.h mac80211: verify that skb data is present 2012-11-17 13:16:11 -08:00
checksum.h
cipso_ipv4.h net: fix cipso packet validation when !NETLABEL 2013-11-04 04:23:41 -08:00
cls_cgroup.h
compat.h
datalink.h
dcbevent.h
dcbnl.h
dn.h
dn_dev.h
dn_fib.h
dn_neigh.h
dn_nsp.h
dn_route.h
dsa.h
dsfield.h
dst.h net: dst: provide accessor function to dst->xfrm 2013-11-04 04:23:41 -08:00
dst_ops.h
esp.h
ethoc.h
fib_rules.h
flow.h
flow_keys.h
garp.h
gen_stats.h
genetlink.h
gre.h
icmp.h
ieee80211_radiotap.h
ieee802154.h
ieee802154_netdev.h
if_inet6.h
inet6_connection_sock.h
inet6_hashtables.h ipv6: use a stronger hash for tcp 2013-02-28 06:59:06 -08:00
inet_common.h
inet_connection_sock.h inet: Fix kmemleak in tcp_v4/6_syn_recv_sock and dccp_v4/6_request_recv_sock 2013-01-11 09:07:14 -08:00
inet_ecn.h
inet_frag.h inet: limit length of fragment queue hash table bucket lists 2013-03-28 12:11:54 -07:00
inet_hashtables.h
inet_sock.h ipv6: use a stronger hash for tcp 2013-02-28 06:59:06 -08:00
inet_timewait_sock.h
inetpeer.h inetpeer: get rid of ip_id_count 2014-08-14 08:42:35 +08:00
ip.h ip: make IP identifiers less predictable 2014-08-14 08:42:35 +08:00
ip6_checksum.h
ip6_fib.h
ip6_route.h ipv6: Limit mtu to 65575 bytes 2014-06-07 16:01:59 -07:00
ip6_tunnel.h
ip_fib.h ipv4: fix definition of FIB_TABLE_HASHSZ 2013-03-28 12:11:53 -07:00
ip_vs.h ipvs: fix oops on NAT reply in br_nf context 2012-10-21 09:28:00 -07:00
ipcomp.h
ipconfig.h
ipip.h inetpeer: get rid of ip_id_count 2014-08-14 08:42:35 +08:00
ipv6.h drivers/net, ipv6: Select IPv6 fragment idents for virtio UFO packets 2015-02-02 17:05:26 +08:00
ipx.h
iw_handler.h
lapb.h
lib80211.h
llc.h
llc_c_ac.h
llc_c_ev.h
llc_c_st.h
llc_conn.h
llc_if.h
llc_pdu.h
llc_s_ac.h
llc_s_ev.h
llc_s_st.h
llc_sap.h
mac80211.h mac80211: introduce IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL 2014-06-07 16:02:07 -07:00
mip6.h
mld.h
ndisc.h
neighbour.h
net_namespace.h
net_ratelimit.h
netdma.h
netevent.h
netlabel.h
netlink.h
netprio_cgroup.h
netrom.h
nexthop.h
nl802154.h
p8022.h
ping.h
pkt_cls.h
pkt_sched.h
protocol.h
psnap.h
raw.h
rawv6.h
red.h
regulatory.h regulatory: add NUL to alpha2 2014-12-01 18:02:22 +08:00
request_sock.h
rose.h
route.h
rtnetlink.h
sch_generic.h
scm.h net: fix incorrect credentials passing 2013-05-01 09:41:16 -07:00
secure_seq.h inetpeer: get rid of ip_id_count 2014-08-14 08:42:35 +08:00
slhc_vj.h
snmp.h
sock.h ipv6: do not clear pinet6 field 2013-05-19 10:54:47 -07:00
stp.h
tcp.h tcp: force a dst refcount when prequeue packet 2013-05-19 10:54:43 -07:00
tcp_memcontrol.h
tcp_states.h
timewait_sock.h
transp_v6.h
udp.h ipv6: call udp_push_pending_frames when uncorking a socket with AF_INET pending data 2013-07-28 16:26:02 -07:00
udplite.h
wext.h
wimax.h
wpan-phy.h
x25.h
x25device.h
xfrm.h xfrm: Workaround incompatibility of ESN and async crypto 2012-10-13 05:38:40 +09:00