aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/sctp/associola.c17
-rw-r--r--net/sctp/endpointola.c4
-rw-r--r--net/sctp/sm_make_chunk.c2
-rw-r--r--net/sctp/sm_statefuns.c4
-rw-r--r--net/sctp/socket.c5
5 files changed, 19 insertions, 13 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index ab3141f05921..3be8b6081a15 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -533,6 +533,8 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
533 struct sctp_transport *peer; 533 struct sctp_transport *peer;
534 struct sctp_sock *sp; 534 struct sctp_sock *sp;
535 unsigned short port; 535 unsigned short port;
536 union sctp_addr tmp;
537 flip_to_n(&tmp, addr);
536 538
537 sp = sctp_sk(asoc->base.sk); 539 sp = sctp_sk(asoc->base.sk);
538 540
@@ -551,7 +553,7 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
551 asoc->peer.port = port; 553 asoc->peer.port = port;
552 554
553 /* Check to see if this is a duplicate. */ 555 /* Check to see if this is a duplicate. */
554 peer = sctp_assoc_lookup_paddr(asoc, addr); 556 peer = sctp_assoc_lookup_paddr(asoc, &tmp);
555 if (peer) { 557 if (peer) {
556 if (peer->state == SCTP_UNKNOWN) { 558 if (peer->state == SCTP_UNKNOWN) {
557 if (peer_state == SCTP_ACTIVE) 559 if (peer_state == SCTP_ACTIVE)
@@ -684,14 +686,12 @@ struct sctp_transport *sctp_assoc_lookup_paddr(
684{ 686{
685 struct sctp_transport *t; 687 struct sctp_transport *t;
686 struct list_head *pos; 688 struct list_head *pos;
687 union sctp_addr tmp;
688 689
689 flip_to_n(&tmp, address);
690 /* Cycle through all transports searching for a peer address. */ 690 /* Cycle through all transports searching for a peer address. */
691 691
692 list_for_each(pos, &asoc->peer.transport_addr_list) { 692 list_for_each(pos, &asoc->peer.transport_addr_list) {
693 t = list_entry(pos, struct sctp_transport, transports); 693 t = list_entry(pos, struct sctp_transport, transports);
694 if (sctp_cmp_addr_exact(&tmp, &t->ipaddr)) 694 if (sctp_cmp_addr_exact(address, &t->ipaddr))
695 return t; 695 return t;
696 } 696 }
697 697
@@ -927,14 +927,15 @@ struct sctp_transport *sctp_assoc_is_match(struct sctp_association *asoc,
927 const union sctp_addr *paddr) 927 const union sctp_addr *paddr)
928{ 928{
929 struct sctp_transport *transport; 929 struct sctp_transport *transport;
930 union sctp_addr tmp; 930 union sctp_addr tmp, tmp2;
931 flip_to_n(&tmp, laddr); 931 flip_to_n(&tmp, laddr);
932 flip_to_n(&tmp2, paddr);
932 933
933 sctp_read_lock(&asoc->base.addr_lock); 934 sctp_read_lock(&asoc->base.addr_lock);
934 935
935 if ((asoc->base.bind_addr.port == laddr->v4.sin_port) && 936 if ((asoc->base.bind_addr.port == laddr->v4.sin_port) &&
936 (asoc->peer.port == paddr->v4.sin_port)) { 937 (asoc->peer.port == paddr->v4.sin_port)) {
937 transport = sctp_assoc_lookup_paddr(asoc, paddr); 938 transport = sctp_assoc_lookup_paddr(asoc, &tmp2);
938 if (!transport) 939 if (!transport)
939 goto out; 940 goto out;
940 941
@@ -1047,7 +1048,7 @@ void sctp_assoc_update(struct sctp_association *asoc,
1047 /* Remove any peer addresses not present in the new association. */ 1048 /* Remove any peer addresses not present in the new association. */
1048 list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) { 1049 list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
1049 trans = list_entry(pos, struct sctp_transport, transports); 1050 trans = list_entry(pos, struct sctp_transport, transports);
1050 if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr_h)) 1051 if (!sctp_assoc_lookup_paddr(new, &trans->ipaddr))
1051 sctp_assoc_del_peer(asoc, &trans->ipaddr); 1052 sctp_assoc_del_peer(asoc, &trans->ipaddr);
1052 } 1053 }
1053 1054
@@ -1071,7 +1072,7 @@ void sctp_assoc_update(struct sctp_association *asoc,
1071 list_for_each(pos, &new->peer.transport_addr_list) { 1072 list_for_each(pos, &new->peer.transport_addr_list) {
1072 trans = list_entry(pos, struct sctp_transport, 1073 trans = list_entry(pos, struct sctp_transport,
1073 transports); 1074 transports);
1074 if (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr_h)) 1075 if (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr))
1075 sctp_assoc_add_peer(asoc, &trans->ipaddr_h, 1076 sctp_assoc_add_peer(asoc, &trans->ipaddr_h,
1076 GFP_ATOMIC, trans->state); 1077 GFP_ATOMIC, trans->state);
1077 } 1078 }
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index d77fe9232dd1..7c781d663603 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -259,6 +259,8 @@ static struct sctp_association *__sctp_endpoint_lookup_assoc(
259 int rport; 259 int rport;
260 struct sctp_association *asoc; 260 struct sctp_association *asoc;
261 struct list_head *pos; 261 struct list_head *pos;
262 union sctp_addr tmp;
263 flip_to_n(&tmp, paddr);
262 264
263 rport = paddr->v4.sin_port; 265 rport = paddr->v4.sin_port;
264 266
@@ -266,7 +268,7 @@ static struct sctp_association *__sctp_endpoint_lookup_assoc(
266 asoc = list_entry(pos, struct sctp_association, asocs); 268 asoc = list_entry(pos, struct sctp_association, asocs);
267 if (rport == asoc->peer.port) { 269 if (rport == asoc->peer.port) {
268 sctp_read_lock(&asoc->base.addr_lock); 270 sctp_read_lock(&asoc->base.addr_lock);
269 *transport = sctp_assoc_lookup_paddr(asoc, paddr); 271 *transport = sctp_assoc_lookup_paddr(asoc, &tmp);
270 sctp_read_unlock(&asoc->base.addr_lock); 272 sctp_read_unlock(&asoc->base.addr_lock);
271 273
272 if (*transport) 274 if (*transport)
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 303830b40ab3..cc1b01152c34 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -2466,7 +2466,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,
2466 sctp_assoc_del_peer(asoc, &tmp_addr); 2466 sctp_assoc_del_peer(asoc, &tmp_addr);
2467 break; 2467 break;
2468 case SCTP_PARAM_SET_PRIMARY: 2468 case SCTP_PARAM_SET_PRIMARY:
2469 peer = sctp_assoc_lookup_paddr(asoc, &addr); 2469 peer = sctp_assoc_lookup_paddr(asoc, &tmp_addr);
2470 if (!peer) 2470 if (!peer)
2471 return SCTP_ERROR_INV_PARAM; 2471 return SCTP_ERROR_INV_PARAM;
2472 2472
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index ac776fd20667..7d722f5a31d7 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -1018,6 +1018,7 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const struct sctp_endpoint *ep,
1018 struct sctp_transport *link; 1018 struct sctp_transport *link;
1019 sctp_sender_hb_info_t *hbinfo; 1019 sctp_sender_hb_info_t *hbinfo;
1020 unsigned long max_interval; 1020 unsigned long max_interval;
1021 union sctp_addr tmp;
1021 1022
1022 if (!sctp_vtag_verify(chunk, asoc)) 1023 if (!sctp_vtag_verify(chunk, asoc))
1023 return sctp_sf_pdiscard(ep, asoc, type, arg, commands); 1024 return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
@@ -1035,7 +1036,8 @@ sctp_disposition_t sctp_sf_backbeat_8_3(const struct sctp_endpoint *ep,
1035 } 1036 }
1036 1037
1037 from_addr = hbinfo->daddr; 1038 from_addr = hbinfo->daddr;
1038 link = sctp_assoc_lookup_paddr(asoc, &from_addr); 1039 flip_to_n(&tmp, &from_addr);
1040 link = sctp_assoc_lookup_paddr(asoc, &tmp);
1039 1041
1040 /* This should never happen, but lets log it if so. */ 1042 /* This should never happen, but lets log it if so. */
1041 if (unlikely(!link)) { 1043 if (unlikely(!link)) {
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index d42953efa355..ffdad8e842ac 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1370,7 +1370,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1370 struct sctp_association *new_asoc=NULL, *asoc=NULL; 1370 struct sctp_association *new_asoc=NULL, *asoc=NULL;
1371 struct sctp_transport *transport, *chunk_tp; 1371 struct sctp_transport *transport, *chunk_tp;
1372 struct sctp_chunk *chunk; 1372 struct sctp_chunk *chunk;
1373 union sctp_addr to; 1373 union sctp_addr to, tmp;
1374 struct sockaddr *msg_name = NULL; 1374 struct sockaddr *msg_name = NULL;
1375 struct sctp_sndrcvinfo default_sinfo = { 0 }; 1375 struct sctp_sndrcvinfo default_sinfo = { 0 };
1376 struct sctp_sndrcvinfo *sinfo; 1376 struct sctp_sndrcvinfo *sinfo;
@@ -1424,6 +1424,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1424 if (msg_namelen > sizeof(to)) 1424 if (msg_namelen > sizeof(to))
1425 msg_namelen = sizeof(to); 1425 msg_namelen = sizeof(to);
1426 memcpy(&to, msg->msg_name, msg_namelen); 1426 memcpy(&to, msg->msg_name, msg_namelen);
1427 memcpy(&tmp, msg->msg_name, msg_namelen);
1427 SCTP_DEBUG_PRINTK("Just memcpy'd. msg_name is " 1428 SCTP_DEBUG_PRINTK("Just memcpy'd. msg_name is "
1428 "0x%x:%u.\n", 1429 "0x%x:%u.\n",
1429 to.v4.sin_addr.s_addr, to.v4.sin_port); 1430 to.v4.sin_addr.s_addr, to.v4.sin_port);
@@ -1691,7 +1692,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1691 */ 1692 */
1692 if ((sctp_style(sk, TCP) && msg_name) || 1693 if ((sctp_style(sk, TCP) && msg_name) ||
1693 (sinfo_flags & SCTP_ADDR_OVER)) { 1694 (sinfo_flags & SCTP_ADDR_OVER)) {
1694 chunk_tp = sctp_assoc_lookup_paddr(asoc, &to); 1695 chunk_tp = sctp_assoc_lookup_paddr(asoc, &tmp);
1695 if (!chunk_tp) { 1696 if (!chunk_tp) {
1696 err = -EINVAL; 1697 err = -EINVAL;
1697 goto out_free; 1698 goto out_free;