aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r--net/sctp/socket.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 56f77d35a8e1..02b27145b279 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1000,7 +1000,6 @@ static int __sctp_connect(struct sock* sk,
1000 goto out_free; 1000 goto out_free;
1001 1001
1002 memcpy(&to, sa_addr, af->sockaddr_len); 1002 memcpy(&to, sa_addr, af->sockaddr_len);
1003 to.v4.sin_port = ntohs(to.v4.sin_port);
1004 1003
1005 /* Check if there already is a matching association on the 1004 /* Check if there already is a matching association on the
1006 * endpoint (other than the one created here). 1005 * endpoint (other than the one created here).
@@ -1049,7 +1048,7 @@ static int __sctp_connect(struct sock* sk,
1049 } 1048 }
1050 } 1049 }
1051 1050
1052 scope = sctp_scope(&to); 1051 scope = sctp_scope(sa_addr);
1053 asoc = sctp_association_new(ep, sk, scope, GFP_KERNEL); 1052 asoc = sctp_association_new(ep, sk, scope, GFP_KERNEL);
1054 if (!asoc) { 1053 if (!asoc) {
1055 err = -ENOMEM; 1054 err = -ENOMEM;
@@ -1357,7 +1356,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1357 struct sctp_association *new_asoc=NULL, *asoc=NULL; 1356 struct sctp_association *new_asoc=NULL, *asoc=NULL;
1358 struct sctp_transport *transport, *chunk_tp; 1357 struct sctp_transport *transport, *chunk_tp;
1359 struct sctp_chunk *chunk; 1358 struct sctp_chunk *chunk;
1360 union sctp_addr to, tmp; 1359 union sctp_addr to;
1361 struct sockaddr *msg_name = NULL; 1360 struct sockaddr *msg_name = NULL;
1362 struct sctp_sndrcvinfo default_sinfo = { 0 }; 1361 struct sctp_sndrcvinfo default_sinfo = { 0 };
1363 struct sctp_sndrcvinfo *sinfo; 1362 struct sctp_sndrcvinfo *sinfo;
@@ -1411,12 +1410,6 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1411 if (msg_namelen > sizeof(to)) 1410 if (msg_namelen > sizeof(to))
1412 msg_namelen = sizeof(to); 1411 msg_namelen = sizeof(to);
1413 memcpy(&to, msg->msg_name, msg_namelen); 1412 memcpy(&to, msg->msg_name, msg_namelen);
1414 memcpy(&tmp, msg->msg_name, msg_namelen);
1415 SCTP_DEBUG_PRINTK("Just memcpy'd. msg_name is "
1416 "0x%x:%u.\n",
1417 to.v4.sin_addr.s_addr, to.v4.sin_port);
1418
1419 to.v4.sin_port = ntohs(to.v4.sin_port);
1420 msg_name = msg->msg_name; 1413 msg_name = msg->msg_name;
1421 } 1414 }
1422 1415
@@ -1466,7 +1459,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1466 /* If a msg_name has been specified, assume this is to be used. */ 1459 /* If a msg_name has been specified, assume this is to be used. */
1467 if (msg_name) { 1460 if (msg_name) {
1468 /* Look for a matching association on the endpoint. */ 1461 /* Look for a matching association on the endpoint. */
1469 asoc = sctp_endpoint_lookup_assoc(ep, &tmp, &transport); 1462 asoc = sctp_endpoint_lookup_assoc(ep, &to, &transport);
1470 if (!asoc) { 1463 if (!asoc) {
1471 /* If we could not find a matching association on the 1464 /* If we could not find a matching association on the
1472 * endpoint, make sure that it is not a TCP-style 1465 * endpoint, make sure that it is not a TCP-style
@@ -1475,7 +1468,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1475 */ 1468 */
1476 if ((sctp_style(sk, TCP) && 1469 if ((sctp_style(sk, TCP) &&
1477 sctp_sstate(sk, ESTABLISHED)) || 1470 sctp_sstate(sk, ESTABLISHED)) ||
1478 sctp_endpoint_is_peeled_off(ep, &tmp)) { 1471 sctp_endpoint_is_peeled_off(ep, &to)) {
1479 err = -EADDRNOTAVAIL; 1472 err = -EADDRNOTAVAIL;
1480 goto out_unlock; 1473 goto out_unlock;
1481 } 1474 }
@@ -1612,7 +1605,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1612 } 1605 }
1613 1606
1614 /* Prime the peer's transport structures. */ 1607 /* Prime the peer's transport structures. */
1615 transport = sctp_assoc_add_peer(asoc, &tmp, GFP_KERNEL, SCTP_UNKNOWN); 1608 transport = sctp_assoc_add_peer(asoc, &to, GFP_KERNEL, SCTP_UNKNOWN);
1616 if (!transport) { 1609 if (!transport) {
1617 err = -ENOMEM; 1610 err = -ENOMEM;
1618 goto out_free; 1611 goto out_free;
@@ -1679,7 +1672,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1679 */ 1672 */
1680 if ((sctp_style(sk, TCP) && msg_name) || 1673 if ((sctp_style(sk, TCP) && msg_name) ||
1681 (sinfo_flags & SCTP_ADDR_OVER)) { 1674 (sinfo_flags & SCTP_ADDR_OVER)) {
1682 chunk_tp = sctp_assoc_lookup_paddr(asoc, &tmp); 1675 chunk_tp = sctp_assoc_lookup_paddr(asoc, &to);
1683 if (!chunk_tp) { 1676 if (!chunk_tp) {
1684 err = -EINVAL; 1677 err = -EINVAL;
1685 goto out_free; 1678 goto out_free;