summaryrefslogtreecommitdiffstats
path: root/net/sctp/input.c
diff options
context:
space:
mode:
authorXin Long <lucien.xin@gmail.com>2016-02-15 07:28:03 +0100
committerDavid S. Miller <davem@davemloft.net>2016-02-17 21:41:54 +0100
commitf46c7011b062726b798fa3326b5b0c2711ead2a0 (patch)
tree9215761a2e50d904ae301f366deea5aa4d2da6f0 /net/sctp/input.c
parentcore: remove unneded headers for net cgroup controllers. (diff)
downloadlinux-f46c7011b062726b798fa3326b5b0c2711ead2a0.tar.xz
linux-f46c7011b062726b798fa3326b5b0c2711ead2a0.zip
sctp: move rcu_read_lock from __sctp_lookup_association to sctp_lookup_association
__sctp_lookup_association() is only invoked by sctp_v4_err() and sctp_rcv(), both which run on the rx BH, and it has been protected by rcu_read_lock [see ip_local_deliver_finish() / ipv6_rcv()]. So we can move it to sctp_lookup_association, only let sctp_lookup_association use rcu_read_lock. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/input.c')
-rw-r--r--net/sctp/input.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 49d2cc751386..21a2d6b7abaf 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -937,7 +937,6 @@ static struct sctp_association *__sctp_lookup_association(
struct sctp_transport *t;
struct sctp_association *asoc = NULL;
- rcu_read_lock();
t = sctp_addrs_lookup_transport(net, local, peer);
if (!t || !sctp_transport_hold(t))
goto out;
@@ -949,7 +948,6 @@ static struct sctp_association *__sctp_lookup_association(
sctp_transport_put(t);
out:
- rcu_read_unlock();
return asoc;
}
@@ -962,7 +960,9 @@ 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;
}