Skip to content

Commit

Permalink
sctp: remove rcu_read_lock from sctp_bind_addr_state
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Xin Long authored and David S. Miller committed Jul 9, 2019
1 parent 6c6fbad commit 3cab2af
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions net/sctp/bind_addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,24 +393,19 @@ int sctp_bind_addr_state(const struct sctp_bind_addr *bp,
{
struct sctp_sockaddr_entry *laddr;
struct sctp_af *af;
int state = -1;

af = sctp_get_af_specific(addr->sa.sa_family);
if (unlikely(!af))
return state;
return -1;

rcu_read_lock();
list_for_each_entry_rcu(laddr, &bp->address_list, list) {
if (!laddr->valid)
continue;
if (af->cmp_addr(&laddr->a, addr)) {
state = laddr->state;
break;
}
if (af->cmp_addr(&laddr->a, addr))
return laddr->state;
}
rcu_read_unlock();

return state;
return -1;
}

/* Find the first address in the bind address list that is not present in
Expand Down

0 comments on commit 3cab2af

Please sign in to comment.