diff options
author | Xin Long <lucien.xin@gmail.com> | 2016-01-22 01:49:07 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-01-28 15:59:32 -0800 |
commit | 1eed677933b816978abc4e3e18ecae5f254cb9be (patch) | |
tree | b2eba8266b9f81c2a93d9cb9173962da88fd1399 /include/trace/events/irq.h | |
parent | 2baaa2d1386bd9949877a74ffc0dc0f2c5394b85 (diff) |
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: 4f0087812648 ("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>
Diffstat (limited to 'include/trace/events/irq.h')
0 files changed, 0 insertions, 0 deletions