aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/socket.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-08-07 03:25:24 -0400
committerDavid S. Miller <davem@davemloft.net>2012-08-15 02:30:37 -0400
commit55e26eb95a5345a5796babac98de6d6c42771df1 (patch)
tree65560cf23dbd241f38e86b6b82d1b5d286605ba5 /net/sctp/socket.c
parentebb7e95d9351f77a8ec1fca20eb645051401b7b2 (diff)
sctp: Push struct net down to sctp_chunk_event_lookup
This trickles up through sctp_sm_lookup_event up to sctp_do_sm and up further into sctp_primitiv_NAME before the code reaches places where struct net can be reliably found. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r--net/sctp/socket.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 5b6dd0e3d1f6..a6a4226a922f 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -427,6 +427,7 @@ SCTP_STATIC int sctp_do_bind(struct sock *sk, union sctp_addr *addr, int len)
427static int sctp_send_asconf(struct sctp_association *asoc, 427static int sctp_send_asconf(struct sctp_association *asoc,
428 struct sctp_chunk *chunk) 428 struct sctp_chunk *chunk)
429{ 429{
430 struct net *net = sock_net(asoc->base.sk);
430 int retval = 0; 431 int retval = 0;
431 432
432 /* If there is an outstanding ASCONF chunk, queue it for later 433 /* If there is an outstanding ASCONF chunk, queue it for later
@@ -439,7 +440,7 @@ static int sctp_send_asconf(struct sctp_association *asoc,
439 440
440 /* Hold the chunk until an ASCONF_ACK is received. */ 441 /* Hold the chunk until an ASCONF_ACK is received. */
441 sctp_chunk_hold(chunk); 442 sctp_chunk_hold(chunk);
442 retval = sctp_primitive_ASCONF(asoc, chunk); 443 retval = sctp_primitive_ASCONF(net, asoc, chunk);
443 if (retval) 444 if (retval)
444 sctp_chunk_free(chunk); 445 sctp_chunk_free(chunk);
445 else 446 else
@@ -1050,6 +1051,7 @@ static int __sctp_connect(struct sock* sk,
1050 int addrs_size, 1051 int addrs_size,
1051 sctp_assoc_t *assoc_id) 1052 sctp_assoc_t *assoc_id)
1052{ 1053{
1054 struct net *net = sock_net(sk);
1053 struct sctp_sock *sp; 1055 struct sctp_sock *sp;
1054 struct sctp_endpoint *ep; 1056 struct sctp_endpoint *ep;
1055 struct sctp_association *asoc = NULL; 1057 struct sctp_association *asoc = NULL;
@@ -1200,7 +1202,7 @@ static int __sctp_connect(struct sock* sk,
1200 goto out_free; 1202 goto out_free;
1201 } 1203 }
1202 1204
1203 err = sctp_primitive_ASSOCIATE(asoc, NULL); 1205 err = sctp_primitive_ASSOCIATE(net, asoc, NULL);
1204 if (err < 0) { 1206 if (err < 0) {
1205 goto out_free; 1207 goto out_free;
1206 } 1208 }
@@ -1458,6 +1460,7 @@ SCTP_STATIC int sctp_getsockopt_connectx3(struct sock* sk, int len,
1458 */ 1460 */
1459SCTP_STATIC void sctp_close(struct sock *sk, long timeout) 1461SCTP_STATIC void sctp_close(struct sock *sk, long timeout)
1460{ 1462{
1463 struct net *net = sock_net(sk);
1461 struct sctp_endpoint *ep; 1464 struct sctp_endpoint *ep;
1462 struct sctp_association *asoc; 1465 struct sctp_association *asoc;
1463 struct list_head *pos, *temp; 1466 struct list_head *pos, *temp;
@@ -1499,9 +1502,9 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)
1499 1502
1500 chunk = sctp_make_abort_user(asoc, NULL, 0); 1503 chunk = sctp_make_abort_user(asoc, NULL, 0);
1501 if (chunk) 1504 if (chunk)
1502 sctp_primitive_ABORT(asoc, chunk); 1505 sctp_primitive_ABORT(net, asoc, chunk);
1503 } else 1506 } else
1504 sctp_primitive_SHUTDOWN(asoc, NULL); 1507 sctp_primitive_SHUTDOWN(net, asoc, NULL);
1505 } 1508 }
1506 1509
1507 /* On a TCP-style socket, block for at most linger_time if set. */ 1510 /* On a TCP-style socket, block for at most linger_time if set. */
@@ -1569,6 +1572,7 @@ SCTP_STATIC int sctp_msghdr_parse(const struct msghdr *, sctp_cmsgs_t *);
1569SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, 1572SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1570 struct msghdr *msg, size_t msg_len) 1573 struct msghdr *msg, size_t msg_len)
1571{ 1574{
1575 struct net *net = sock_net(sk);
1572 struct sctp_sock *sp; 1576 struct sctp_sock *sp;
1573 struct sctp_endpoint *ep; 1577 struct sctp_endpoint *ep;
1574 struct sctp_association *new_asoc=NULL, *asoc=NULL; 1578 struct sctp_association *new_asoc=NULL, *asoc=NULL;
@@ -1714,7 +1718,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1714 if (sinfo_flags & SCTP_EOF) { 1718 if (sinfo_flags & SCTP_EOF) {
1715 SCTP_DEBUG_PRINTK("Shutting down association: %p\n", 1719 SCTP_DEBUG_PRINTK("Shutting down association: %p\n",
1716 asoc); 1720 asoc);
1717 sctp_primitive_SHUTDOWN(asoc, NULL); 1721 sctp_primitive_SHUTDOWN(net, asoc, NULL);
1718 err = 0; 1722 err = 0;
1719 goto out_unlock; 1723 goto out_unlock;
1720 } 1724 }
@@ -1727,7 +1731,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1727 } 1731 }
1728 1732
1729 SCTP_DEBUG_PRINTK("Aborting association: %p\n", asoc); 1733 SCTP_DEBUG_PRINTK("Aborting association: %p\n", asoc);
1730 sctp_primitive_ABORT(asoc, chunk); 1734 sctp_primitive_ABORT(net, asoc, chunk);
1731 err = 0; 1735 err = 0;
1732 goto out_unlock; 1736 goto out_unlock;
1733 } 1737 }
@@ -1900,7 +1904,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1900 1904
1901 /* Auto-connect, if we aren't connected already. */ 1905 /* Auto-connect, if we aren't connected already. */
1902 if (sctp_state(asoc, CLOSED)) { 1906 if (sctp_state(asoc, CLOSED)) {
1903 err = sctp_primitive_ASSOCIATE(asoc, NULL); 1907 err = sctp_primitive_ASSOCIATE(net, asoc, NULL);
1904 if (err < 0) 1908 if (err < 0)
1905 goto out_free; 1909 goto out_free;
1906 SCTP_DEBUG_PRINTK("We associated primitively.\n"); 1910 SCTP_DEBUG_PRINTK("We associated primitively.\n");
@@ -1928,7 +1932,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1928 * works that way today. Keep it that way or this 1932 * works that way today. Keep it that way or this
1929 * breaks. 1933 * breaks.
1930 */ 1934 */
1931 err = sctp_primitive_SEND(asoc, datamsg); 1935 err = sctp_primitive_SEND(net, asoc, datamsg);
1932 /* Did the lower layer accept the chunk? */ 1936 /* Did the lower layer accept the chunk? */
1933 if (err) 1937 if (err)
1934 sctp_datamsg_free(datamsg); 1938 sctp_datamsg_free(datamsg);
@@ -2320,7 +2324,9 @@ static int sctp_apply_peer_addr_params(struct sctp_paddrparams *params,
2320 int error; 2324 int error;
2321 2325
2322 if (params->spp_flags & SPP_HB_DEMAND && trans) { 2326 if (params->spp_flags & SPP_HB_DEMAND && trans) {
2323 error = sctp_primitive_REQUESTHEARTBEAT (trans->asoc, trans); 2327 struct net *net = sock_net(trans->asoc->base.sk);
2328
2329 error = sctp_primitive_REQUESTHEARTBEAT(net, trans->asoc, trans);
2324 if (error) 2330 if (error)
2325 return error; 2331 return error;
2326 } 2332 }
@@ -4011,6 +4017,7 @@ SCTP_STATIC void sctp_destroy_sock(struct sock *sk)
4011 */ 4017 */
4012SCTP_STATIC void sctp_shutdown(struct sock *sk, int how) 4018SCTP_STATIC void sctp_shutdown(struct sock *sk, int how)
4013{ 4019{
4020 struct net *net = sock_net(sk);
4014 struct sctp_endpoint *ep; 4021 struct sctp_endpoint *ep;
4015 struct sctp_association *asoc; 4022 struct sctp_association *asoc;
4016 4023
@@ -4022,7 +4029,7 @@ SCTP_STATIC void sctp_shutdown(struct sock *sk, int how)
4022 if (!list_empty(&ep->asocs)) { 4029 if (!list_empty(&ep->asocs)) {
4023 asoc = list_entry(ep->asocs.next, 4030 asoc = list_entry(ep->asocs.next,
4024 struct sctp_association, asocs); 4031 struct sctp_association, asocs);
4025 sctp_primitive_SHUTDOWN(asoc, NULL); 4032 sctp_primitive_SHUTDOWN(net, asoc, NULL);
4026 } 4033 }
4027 } 4034 }
4028} 4035}