android_kernel_xiaomi_sdm845/net/sctp
Vladislav Yasevich 61c9fed416 [SCTP]: A better solution to fix the race between sctp_peeloff() and
sctp_rcv().

The goal is to hold the ref on the association/endpoint throughout the
state-machine process.  We accomplish like this:

  /* ref on the assoc/ep is taken during lookup */

  if owned_by_user(sk)
 	sctp_add_backlog(skb, sk);
  else
 	inqueue_push(skb, sk);

  /* drop the ref on the assoc/ep */

However, in sctp_add_backlog() we take the ref on assoc/ep and hold it
while the skb is on the backlog queue.  This allows us to get rid of the
sock_hold/sock_put in the lookup routines.

Now sctp_backlog_rcv() needs to account for potential association move.
In the unlikely event that association moved, we need to retest if the
new socket is locked by user.  If we don't this, we may have two packets
racing up the stack toward the same socket and we can't deal with it.
If the new socket is still locked, we'll just add the skb to its backlog
continuing to hold the ref on the association.  This get's rid of the
need to move packets from one backlog to another and it also safe in
case new packets arrive on the same backlog queue.

The last step, is to lock the new socket when we are moving the
association to it.  This is needed in case any new packets arrive on
the association when it moved.  We want these to go to the backlog since
we would like to avoid the race between this new packet and a packet
that may be sitting on the backlog queue of the old socket toward the
same association.

Signed-off-by: Vladislav Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
2006-05-19 11:01:18 -07:00
..
associola.c [SCTP]: Update SCTP_PEER_ADDR_PARAMS socket option to the latest api draft. 2006-01-03 13:11:11 -08:00
bind_addr.c [PATCH] gfp flags annotations - part 1 2005-10-08 15:00:57 -07:00
chunk.c [PATCH] gfp flags annotations - part 1 2005-10-08 15:00:57 -07:00
command.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
crc32c.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
debug.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
endpointola.c [SCTP]: Include ulpevents in socket receive buffer accounting. 2005-11-11 16:08:24 -08:00
input.c [SCTP]: A better solution to fix the race between sctp_peeloff() and 2006-05-19 11:01:18 -07:00
inqueue.c [SCTP]: Allow spillover of receive buffer to avoid deadlock. 2006-05-05 17:02:09 -07:00
ipv6.c [NET]: Identation & other cleanups related to compat_[gs]etsockopt cset 2006-03-20 22:48:35 -08:00
Kconfig Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Makefile Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
objcnt.c [SCTP]: Audit return code of create_proc_* 2005-07-18 13:38:07 -07:00
output.c [SCTP]: Fix 'fast retransmit' to send a TSN only once. 2006-02-02 16:57:31 -08:00
outqueue.c [SCTP]: Fix 'fast retransmit' to send a TSN only once. 2006-02-02 16:57:31 -08:00
primitive.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
proc.c [PATCH] for_each_possible_cpu: network codes 2006-04-11 06:18:31 -07:00
protocol.c [NET]: Identation & other cleanups related to compat_[gs]etsockopt cset 2006-03-20 22:48:35 -08:00
sm_make_chunk.c [SCTP]: Fix machine check/connection hang on IA64. 2006-01-17 11:55:57 -08:00
sm_sideeffect.c [SCTP]: Set sk_err so that poll wakes up after a non-blocking connect failure. 2006-05-19 10:58:12 -07:00
sm_statefuns.c [SCTP]: Set sk_err so that poll wakes up after a non-blocking connect failure. 2006-05-19 10:58:12 -07:00
sm_statetable.c [SCTP]: Fix state table entries for chunks received in CLOSED state. 2006-05-05 17:05:23 -07:00
socket.c [SCTP]: A better solution to fix the race between sctp_peeloff() and 2006-05-19 11:01:18 -07:00
ssnmap.c [PATCH] gfp flags annotations - part 1 2005-10-08 15:00:57 -07:00
sysctl.c [SCTP]: Fix bad sysctl formatting of SCTP timeout values on 64-bit m/cs. 2006-01-17 11:55:17 -08:00
transport.c [SCTP]: Fix bad sysctl formatting of SCTP timeout values on 64-bit m/cs. 2006-01-17 11:55:17 -08:00
tsnmap.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ulpevent.c [SCTP]: Include ulpevents in socket receive buffer accounting. 2005-11-11 16:08:24 -08:00
ulpqueue.c [SCTP]: Prevent possible infinite recursion with multiple bundled DATA. 2006-05-05 17:03:49 -07:00