Skip to content

Commit 3cab2af

Browse files
lxindavem330
authored andcommitted
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>
1 parent 6c6fbad commit 3cab2af

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

net/sctp/bind_addr.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -393,24 +393,19 @@ int sctp_bind_addr_state(const struct sctp_bind_addr *bp,
393393
{
394394
struct sctp_sockaddr_entry *laddr;
395395
struct sctp_af *af;
396-
int state = -1;
397396

398397
af = sctp_get_af_specific(addr->sa.sa_family);
399398
if (unlikely(!af))
400-
return state;
399+
return -1;
401400

402-
rcu_read_lock();
403401
list_for_each_entry_rcu(laddr, &bp->address_list, list) {
404402
if (!laddr->valid)
405403
continue;
406-
if (af->cmp_addr(&laddr->a, addr)) {
407-
state = laddr->state;
408-
break;
409-
}
404+
if (af->cmp_addr(&laddr->a, addr))
405+
return laddr->state;
410406
}
411-
rcu_read_unlock();
412407

413-
return state;
408+
return -1;
414409
}
415410

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

0 commit comments

Comments
 (0)