aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/associola.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sctp/associola.c')
-rw-r--r--net/sctp/associola.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 498edb0cd4e5..9bad8ba0feda 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -99,7 +99,6 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a
99 99
100 /* Initialize the bind addr area. */ 100 /* Initialize the bind addr area. */
101 sctp_bind_addr_init(&asoc->base.bind_addr, ep->base.bind_addr.port); 101 sctp_bind_addr_init(&asoc->base.bind_addr, ep->base.bind_addr.port);
102 rwlock_init(&asoc->base.addr_lock);
103 102
104 asoc->state = SCTP_STATE_CLOSED; 103 asoc->state = SCTP_STATE_CLOSED;
105 104
@@ -727,7 +726,12 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
727 break; 726 break;
728 727
729 case SCTP_TRANSPORT_DOWN: 728 case SCTP_TRANSPORT_DOWN:
730 transport->state = SCTP_INACTIVE; 729 /* if the transort was never confirmed, do not transition it
730 * to inactive state.
731 */
732 if (transport->state != SCTP_UNCONFIRMED)
733 transport->state = SCTP_INACTIVE;
734
731 spc_state = SCTP_ADDR_UNREACHABLE; 735 spc_state = SCTP_ADDR_UNREACHABLE;
732 break; 736 break;
733 737
@@ -932,8 +936,6 @@ struct sctp_transport *sctp_assoc_is_match(struct sctp_association *asoc,
932{ 936{
933 struct sctp_transport *transport; 937 struct sctp_transport *transport;
934 938
935 sctp_read_lock(&asoc->base.addr_lock);
936
937 if ((htons(asoc->base.bind_addr.port) == laddr->v4.sin_port) && 939 if ((htons(asoc->base.bind_addr.port) == laddr->v4.sin_port) &&
938 (htons(asoc->peer.port) == paddr->v4.sin_port)) { 940 (htons(asoc->peer.port) == paddr->v4.sin_port)) {
939 transport = sctp_assoc_lookup_paddr(asoc, paddr); 941 transport = sctp_assoc_lookup_paddr(asoc, paddr);
@@ -947,7 +949,6 @@ struct sctp_transport *sctp_assoc_is_match(struct sctp_association *asoc,
947 transport = NULL; 949 transport = NULL;
948 950
949out: 951out:
950 sctp_read_unlock(&asoc->base.addr_lock);
951 return transport; 952 return transport;
952} 953}
953 954
@@ -1371,19 +1372,13 @@ int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *asoc,
1371int sctp_assoc_lookup_laddr(struct sctp_association *asoc, 1372int sctp_assoc_lookup_laddr(struct sctp_association *asoc,
1372 const union sctp_addr *laddr) 1373 const union sctp_addr *laddr)
1373{ 1374{
1374 int found; 1375 int found = 0;
1375 1376
1376 sctp_read_lock(&asoc->base.addr_lock);
1377 if ((asoc->base.bind_addr.port == ntohs(laddr->v4.sin_port)) && 1377 if ((asoc->base.bind_addr.port == ntohs(laddr->v4.sin_port)) &&
1378 sctp_bind_addr_match(&asoc->base.bind_addr, laddr, 1378 sctp_bind_addr_match(&asoc->base.bind_addr, laddr,
1379 sctp_sk(asoc->base.sk))) { 1379 sctp_sk(asoc->base.sk)))
1380 found = 1; 1380 found = 1;
1381 goto out;
1382 }
1383 1381
1384 found = 0;
1385out:
1386 sctp_read_unlock(&asoc->base.addr_lock);
1387 return found; 1382 return found;
1388} 1383}
1389 1384