kernel_optimize_test/net/sctp
Xin Long 1eed677933 sctp: fix the transport dead race check by using atomic_add_unless on refcnt
Now when __sctp_lookup_association is running in BH, it will try to
check if t->dead is set, but meanwhile other CPUs may be freeing this
transport and this assoc and if it happens that
__sctp_lookup_association checked t->dead a bit too early, it may think
that the association is still good while it was already freed.

So we fix this race by using atomic_add_unless in sctp_transport_hold.
After we get one transport from hashtable, we will hold it only when
this transport's refcnt is not 0, so that we can make sure t->asoc
cannot be freed before we hold the asoc again.

Note that sctp association is not freed using RCU so we can't use
atomic_add_unless() with it as it may just be too late for that either.

Fixes: 4f00878126 ("sctp: apply rhashtable api to send/recv path")
Reported-by: Vlad Yasevich <vyasevich@gmail.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-01-28 15:59:32 -08:00
..
associola.c sctp: apply rhashtable api to send/recv path 2016-01-05 12:24:01 -05:00
auth.c
bind_addr.c
chunk.c
debug.c
endpointola.c sctp: the temp asoc's transports should not be hashed/unhashed 2016-01-17 19:11:44 -05:00
input.c sctp: fix the transport dead race check by using atomic_add_unless on refcnt 2016-01-28 15:59:32 -08:00
inqueue.c
ipv6.c ipv6: sctp: clone options to avoid use after free 2015-12-11 20:18:40 -05:00
Kconfig
Makefile
objcnt.c
output.c sctp: Rename NETIF_F_SCTP_CSUM to NETIF_F_SCTP_CRC 2015-12-15 16:49:58 -05:00
outqueue.c sctp: start t5 timer only when peer rwnd is 0 and local state is SHUTDOWN_PENDING 2015-12-06 22:31:51 -05:00
primitive.c
probe.c
proc.c net: sctp: Move sequence start handling into sctp_transport_get_idx() 2016-01-15 15:11:55 -05:00
protocol.c sctp: drop the old assoc hashtable of sctp 2016-01-05 12:24:01 -05:00
sm_make_chunk.c
sm_sideeffect.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-01-11 23:55:43 -05:00
sm_statefuns.c sctp: fix use-after-free in pr_debug statement 2016-01-11 17:13:01 -05:00
sm_statetable.c
socket.c sctp: allow setting SCTP_SACK_IMMEDIATELY by the application 2016-01-24 22:43:21 -08:00
ssnmap.c
sysctl.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-01-11 23:55:43 -05:00
transport.c sctp: fix the transport dead race check by using atomic_add_unless on refcnt 2016-01-28 15:59:32 -08:00
tsnmap.c
ulpevent.c
ulpqueue.c