diff options
author | Xin Long <lucien.xin@gmail.com> | 2019-07-08 12:59:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-07-08 23:18:11 -0400 |
commit | 3cab2afb149ceedd324d14c6562224fb925252a6 (patch) | |
tree | f770202e3dc779b2d2ca2866358e39d2bf91b30a | |
parent | 6c6fbad6576fb19f93770feabcf2d0a30b4ae0e2 (diff) |
sctp: remove rcu_read_lock from sctp_bind_addr_state
sctp_bind_addr_state() is called either in packet rcv path or
by sctp_copy_local_addr_list(), which are under rcu_read_lock.
So there's no need to call it again in sctp_bind_addr_state().
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/sctp/bind_addr.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c index f54333cbbe0f..53bc61537f44 100644 --- a/net/sctp/bind_addr.c +++ b/net/sctp/bind_addr.c | |||
@@ -393,24 +393,19 @@ int sctp_bind_addr_state(const struct sctp_bind_addr *bp, | |||
393 | { | 393 | { |
394 | struct sctp_sockaddr_entry *laddr; | 394 | struct sctp_sockaddr_entry *laddr; |
395 | struct sctp_af *af; | 395 | struct sctp_af *af; |
396 | int state = -1; | ||
397 | 396 | ||
398 | af = sctp_get_af_specific(addr->sa.sa_family); | 397 | af = sctp_get_af_specific(addr->sa.sa_family); |
399 | if (unlikely(!af)) | 398 | if (unlikely(!af)) |
400 | return state; | 399 | return -1; |
401 | 400 | ||
402 | rcu_read_lock(); | ||
403 | list_for_each_entry_rcu(laddr, &bp->address_list, list) { | 401 | list_for_each_entry_rcu(laddr, &bp->address_list, list) { |
404 | if (!laddr->valid) | 402 | if (!laddr->valid) |
405 | continue; | 403 | continue; |
406 | if (af->cmp_addr(&laddr->a, addr)) { | 404 | if (af->cmp_addr(&laddr->a, addr)) |
407 | state = laddr->state; | 405 | return laddr->state; |
408 | break; | ||
409 | } | ||
410 | } | 406 | } |
411 | rcu_read_unlock(); | ||
412 | 407 | ||
413 | return state; | 408 | return -1; |
414 | } | 409 | } |
415 | 410 | ||
416 | /* Find the first address in the bind address list that is not present in | 411 | /* Find the first address in the bind address list that is not present in |