diff options
author | Ingo Molnar <mingo@kernel.org> | 2016-02-18 11:03:57 +0300 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-02-18 11:03:57 +0300 |
commit | 061f817eb6a6f97a7e34b73e5e80baa3a20b7663 (patch) | |
tree | 412332269985de14d5e1ae9eedbfcd73bc635e97 /net/sctp/input.c | |
parent | e6c8f1873be8a14c7e44202df1f7e6ea61bf3352 (diff) | |
parent | 18558cae0272f8fd9647e69d3fec1565a7949865 (diff) | |
download | linux-061f817eb6a6f97a7e34b73e5e80baa3a20b7663.tar.xz |
Merge tag 'v4.5-rc4' into ras/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'net/sctp/input.c')
-rw-r--r-- | net/sctp/input.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/net/sctp/input.c b/net/sctp/input.c index bf61dfb8e09e..49d2cc751386 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c @@ -935,15 +935,22 @@ static struct sctp_association *__sctp_lookup_association( struct sctp_transport **pt) { struct sctp_transport *t; + struct sctp_association *asoc = NULL; + rcu_read_lock(); t = sctp_addrs_lookup_transport(net, local, peer); - if (!t || t->dead) - return NULL; + if (!t || !sctp_transport_hold(t)) + goto out; - sctp_association_hold(t->asoc); + asoc = t->asoc; + sctp_association_hold(asoc); *pt = t; - return t->asoc; + sctp_transport_put(t); + +out: + rcu_read_unlock(); + return asoc; } /* Look up an association. protected by RCU read lock */ @@ -955,9 +962,7 @@ struct sctp_association *sctp_lookup_association(struct net *net, { struct sctp_association *asoc; - rcu_read_lock(); asoc = __sctp_lookup_association(net, laddr, paddr, transportp); - rcu_read_unlock(); return asoc; } |