diff options
author | Xin Long <lucien.xin@gmail.com> | 2016-09-10 23:11:23 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-09-13 11:44:58 -0400 |
commit | 715f5552b1e90ba3eecf6d1a6d044d0d5226663f (patch) | |
tree | 664441229dc29ce34920579093b0fcac85282626 /Documentation/x86 | |
parent | 3e1be7ad2d38c6bd6aeef96df9bd0a7822f4e51c (diff) |
sctp: hold the transport before using it in sctp_hash_cmp
Since commit 4f0087812648 ("sctp: apply rhashtable api to send/recv
path"), sctp uses transport rhashtable with .obj_cmpfn sctp_hash_cmp,
in which it compares the members of the transport with the rhashtable
args to check if it's the right transport.
But sctp uses the transport without holding it in sctp_hash_cmp, it can
cause a use-after-free panic. As after it gets transport from hashtable,
another CPU may close the sk and free the asoc. In sctp_association_free,
it frees all the transports, meanwhile, the assoc's refcnt may be reduced
to 0, assoc can be destroyed by sctp_association_destroy.
So after that, transport->assoc is actually an unavailable memory address
in sctp_hash_cmp. Although sctp_hash_cmp is under rcu_read_lock, it still
can not avoid this, as assoc is not freed by RCU.
This patch is to hold the transport before checking it's members with
sctp_transport_hold, in which it checks the refcnt first, holds it if
it's not 0.
Fixes: 4f0087812648 ("sctp: apply rhashtable api to send/recv path")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'Documentation/x86')
0 files changed, 0 insertions, 0 deletions