aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp
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
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')
-rw-r--r--net/sctp/associola.c5
-rw-r--r--net/sctp/endpointola.c4
-rw-r--r--net/sctp/input.c4
-rw-r--r--net/sctp/primitive.c4
-rw-r--r--net/sctp/sm_sideeffect.c24
-rw-r--r--net/sctp/sm_statetable.c11
-rw-r--r--net/sctp/socket.c27
7 files changed, 51 insertions, 28 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 8a1f27a7a001..6bcbecafe393 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -1118,6 +1118,7 @@ static void sctp_assoc_bh_rcv(struct work_struct *work)
1118 struct sctp_association *asoc = 1118 struct sctp_association *asoc =
1119 container_of(work, struct sctp_association, 1119 container_of(work, struct sctp_association,
1120 base.inqueue.immediate); 1120 base.inqueue.immediate);
1121 struct net *net = sock_net(asoc->base.sk);
1121 struct sctp_endpoint *ep; 1122 struct sctp_endpoint *ep;
1122 struct sctp_chunk *chunk; 1123 struct sctp_chunk *chunk;
1123 struct sctp_inq *inqueue; 1124 struct sctp_inq *inqueue;
@@ -1150,13 +1151,13 @@ static void sctp_assoc_bh_rcv(struct work_struct *work)
1150 if (sctp_chunk_is_data(chunk)) 1151 if (sctp_chunk_is_data(chunk))
1151 asoc->peer.last_data_from = chunk->transport; 1152 asoc->peer.last_data_from = chunk->transport;
1152 else 1153 else
1153 SCTP_INC_STATS(sock_net(asoc->base.sk), SCTP_MIB_INCTRLCHUNKS); 1154 SCTP_INC_STATS(net, SCTP_MIB_INCTRLCHUNKS);
1154 1155
1155 if (chunk->transport) 1156 if (chunk->transport)
1156 chunk->transport->last_time_heard = jiffies; 1157 chunk->transport->last_time_heard = jiffies;
1157 1158
1158 /* Run through the state machine. */ 1159 /* Run through the state machine. */
1159 error = sctp_do_sm(SCTP_EVENT_T_CHUNK, subtype, 1160 error = sctp_do_sm(net, SCTP_EVENT_T_CHUNK, subtype,
1160 state, ep, asoc, chunk, GFP_ATOMIC); 1161 state, ep, asoc, chunk, GFP_ATOMIC);
1161 1162
1162 /* Check to see if the association is freed in response to 1163 /* Check to see if the association is freed in response to
diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c
index 3edca80ab3a1..8315792ef2ba 100644
--- a/net/sctp/endpointola.c
+++ b/net/sctp/endpointola.c
@@ -413,6 +413,7 @@ static void sctp_endpoint_bh_rcv(struct work_struct *work)
413 base.inqueue.immediate); 413 base.inqueue.immediate);
414 struct sctp_association *asoc; 414 struct sctp_association *asoc;
415 struct sock *sk; 415 struct sock *sk;
416 struct net *net;
416 struct sctp_transport *transport; 417 struct sctp_transport *transport;
417 struct sctp_chunk *chunk; 418 struct sctp_chunk *chunk;
418 struct sctp_inq *inqueue; 419 struct sctp_inq *inqueue;
@@ -427,6 +428,7 @@ static void sctp_endpoint_bh_rcv(struct work_struct *work)
427 asoc = NULL; 428 asoc = NULL;
428 inqueue = &ep->base.inqueue; 429 inqueue = &ep->base.inqueue;
429 sk = ep->base.sk; 430 sk = ep->base.sk;
431 net = sock_net(sk);
430 432
431 while (NULL != (chunk = sctp_inq_pop(inqueue))) { 433 while (NULL != (chunk = sctp_inq_pop(inqueue))) {
432 subtype = SCTP_ST_CHUNK(chunk->chunk_hdr->type); 434 subtype = SCTP_ST_CHUNK(chunk->chunk_hdr->type);
@@ -483,7 +485,7 @@ normal:
483 if (chunk->transport) 485 if (chunk->transport)
484 chunk->transport->last_time_heard = jiffies; 486 chunk->transport->last_time_heard = jiffies;
485 487
486 error = sctp_do_sm(SCTP_EVENT_T_CHUNK, subtype, state, 488 error = sctp_do_sm(net, SCTP_EVENT_T_CHUNK, subtype, state,
487 ep, asoc, chunk, GFP_ATOMIC); 489 ep, asoc, chunk, GFP_ATOMIC);
488 490
489 if (error && chunk) 491 if (error && chunk)
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 530830151f04..a2ceb70ee06c 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -466,11 +466,13 @@ void sctp_icmp_proto_unreachable(struct sock *sk,
466 } 466 }
467 467
468 } else { 468 } else {
469 struct net *net = sock_net(sk);
470
469 if (timer_pending(&t->proto_unreach_timer) && 471 if (timer_pending(&t->proto_unreach_timer) &&
470 del_timer(&t->proto_unreach_timer)) 472 del_timer(&t->proto_unreach_timer))
471 sctp_association_put(asoc); 473 sctp_association_put(asoc);
472 474
473 sctp_do_sm(SCTP_EVENT_T_OTHER, 475 sctp_do_sm(net, SCTP_EVENT_T_OTHER,
474 SCTP_ST_OTHER(SCTP_EVENT_ICMP_PROTO_UNREACH), 476 SCTP_ST_OTHER(SCTP_EVENT_ICMP_PROTO_UNREACH),
475 asoc->state, asoc->ep, asoc, t, 477 asoc->state, asoc->ep, asoc, t,
476 GFP_ATOMIC); 478 GFP_ATOMIC);
diff --git a/net/sctp/primitive.c b/net/sctp/primitive.c
index 534c7eae9d15..794bb14decde 100644
--- a/net/sctp/primitive.c
+++ b/net/sctp/primitive.c
@@ -57,7 +57,7 @@
57 57
58#define DECLARE_PRIMITIVE(name) \ 58#define DECLARE_PRIMITIVE(name) \
59/* This is called in the code as sctp_primitive_ ## name. */ \ 59/* This is called in the code as sctp_primitive_ ## name. */ \
60int sctp_primitive_ ## name(struct sctp_association *asoc, \ 60int sctp_primitive_ ## name(struct net *net, struct sctp_association *asoc, \
61 void *arg) { \ 61 void *arg) { \
62 int error = 0; \ 62 int error = 0; \
63 sctp_event_t event_type; sctp_subtype_t subtype; \ 63 sctp_event_t event_type; sctp_subtype_t subtype; \
@@ -69,7 +69,7 @@ int sctp_primitive_ ## name(struct sctp_association *asoc, \
69 state = asoc ? asoc->state : SCTP_STATE_CLOSED; \ 69 state = asoc ? asoc->state : SCTP_STATE_CLOSED; \
70 ep = asoc ? asoc->ep : NULL; \ 70 ep = asoc ? asoc->ep : NULL; \
71 \ 71 \
72 error = sctp_do_sm(event_type, subtype, state, ep, asoc, \ 72 error = sctp_do_sm(net, event_type, subtype, state, ep, asoc, \
73 arg, GFP_KERNEL); \ 73 arg, GFP_KERNEL); \
74 return error; \ 74 return error; \
75} 75}
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index fe99628e1257..02c4c1c066a7 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -251,6 +251,7 @@ void sctp_generate_t3_rtx_event(unsigned long peer)
251 int error; 251 int error;
252 struct sctp_transport *transport = (struct sctp_transport *) peer; 252 struct sctp_transport *transport = (struct sctp_transport *) peer;
253 struct sctp_association *asoc = transport->asoc; 253 struct sctp_association *asoc = transport->asoc;
254 struct net *net = sock_net(asoc->base.sk);
254 255
255 /* Check whether a task is in the sock. */ 256 /* Check whether a task is in the sock. */
256 257
@@ -271,7 +272,7 @@ void sctp_generate_t3_rtx_event(unsigned long peer)
271 goto out_unlock; 272 goto out_unlock;
272 273
273 /* Run through the state machine. */ 274 /* Run through the state machine. */
274 error = sctp_do_sm(SCTP_EVENT_T_TIMEOUT, 275 error = sctp_do_sm(net, SCTP_EVENT_T_TIMEOUT,
275 SCTP_ST_TIMEOUT(SCTP_EVENT_TIMEOUT_T3_RTX), 276 SCTP_ST_TIMEOUT(SCTP_EVENT_TIMEOUT_T3_RTX),
276 asoc->state, 277 asoc->state,
277 asoc->ep, asoc, 278 asoc->ep, asoc,
@@ -291,6 +292,7 @@ out_unlock:
291static void sctp_generate_timeout_event(struct sctp_association *asoc, 292static void sctp_generate_timeout_event(struct sctp_association *asoc,
292 sctp_event_timeout_t timeout_type) 293 sctp_event_timeout_t timeout_type)
293{ 294{
295 struct net *net = sock_net(asoc->base.sk);
294 int error = 0; 296 int error = 0;
295 297
296 sctp_bh_lock_sock(asoc->base.sk); 298 sctp_bh_lock_sock(asoc->base.sk);
@@ -312,7 +314,7 @@ static void sctp_generate_timeout_event(struct sctp_association *asoc,
312 goto out_unlock; 314 goto out_unlock;
313 315
314 /* Run through the state machine. */ 316 /* Run through the state machine. */
315 error = sctp_do_sm(SCTP_EVENT_T_TIMEOUT, 317 error = sctp_do_sm(net, SCTP_EVENT_T_TIMEOUT,
316 SCTP_ST_TIMEOUT(timeout_type), 318 SCTP_ST_TIMEOUT(timeout_type),
317 asoc->state, asoc->ep, asoc, 319 asoc->state, asoc->ep, asoc,
318 (void *)timeout_type, GFP_ATOMIC); 320 (void *)timeout_type, GFP_ATOMIC);
@@ -371,6 +373,7 @@ void sctp_generate_heartbeat_event(unsigned long data)
371 int error = 0; 373 int error = 0;
372 struct sctp_transport *transport = (struct sctp_transport *) data; 374 struct sctp_transport *transport = (struct sctp_transport *) data;
373 struct sctp_association *asoc = transport->asoc; 375 struct sctp_association *asoc = transport->asoc;
376 struct net *net = sock_net(asoc->base.sk);
374 377
375 sctp_bh_lock_sock(asoc->base.sk); 378 sctp_bh_lock_sock(asoc->base.sk);
376 if (sock_owned_by_user(asoc->base.sk)) { 379 if (sock_owned_by_user(asoc->base.sk)) {
@@ -388,7 +391,7 @@ void sctp_generate_heartbeat_event(unsigned long data)
388 if (transport->dead) 391 if (transport->dead)
389 goto out_unlock; 392 goto out_unlock;
390 393
391 error = sctp_do_sm(SCTP_EVENT_T_TIMEOUT, 394 error = sctp_do_sm(net, SCTP_EVENT_T_TIMEOUT,
392 SCTP_ST_TIMEOUT(SCTP_EVENT_TIMEOUT_HEARTBEAT), 395 SCTP_ST_TIMEOUT(SCTP_EVENT_TIMEOUT_HEARTBEAT),
393 asoc->state, asoc->ep, asoc, 396 asoc->state, asoc->ep, asoc,
394 transport, GFP_ATOMIC); 397 transport, GFP_ATOMIC);
@@ -408,6 +411,7 @@ void sctp_generate_proto_unreach_event(unsigned long data)
408{ 411{
409 struct sctp_transport *transport = (struct sctp_transport *) data; 412 struct sctp_transport *transport = (struct sctp_transport *) data;
410 struct sctp_association *asoc = transport->asoc; 413 struct sctp_association *asoc = transport->asoc;
414 struct net *net = sock_net(asoc->base.sk);
411 415
412 sctp_bh_lock_sock(asoc->base.sk); 416 sctp_bh_lock_sock(asoc->base.sk);
413 if (sock_owned_by_user(asoc->base.sk)) { 417 if (sock_owned_by_user(asoc->base.sk)) {
@@ -426,7 +430,7 @@ void sctp_generate_proto_unreach_event(unsigned long data)
426 if (asoc->base.dead) 430 if (asoc->base.dead)
427 goto out_unlock; 431 goto out_unlock;
428 432
429 sctp_do_sm(SCTP_EVENT_T_OTHER, 433 sctp_do_sm(net, SCTP_EVENT_T_OTHER,
430 SCTP_ST_OTHER(SCTP_EVENT_ICMP_PROTO_UNREACH), 434 SCTP_ST_OTHER(SCTP_EVENT_ICMP_PROTO_UNREACH),
431 asoc->state, asoc->ep, asoc, transport, GFP_ATOMIC); 435 asoc->state, asoc->ep, asoc, transport, GFP_ATOMIC);
432 436
@@ -753,8 +757,10 @@ static int sctp_cmd_process_sack(sctp_cmd_seq_t *cmds,
753 int err = 0; 757 int err = 0;
754 758
755 if (sctp_outq_sack(&asoc->outqueue, sackh)) { 759 if (sctp_outq_sack(&asoc->outqueue, sackh)) {
760 struct net *net = sock_net(asoc->base.sk);
761
756 /* There are no more TSNs awaiting SACK. */ 762 /* There are no more TSNs awaiting SACK. */
757 err = sctp_do_sm(SCTP_EVENT_T_OTHER, 763 err = sctp_do_sm(net, SCTP_EVENT_T_OTHER,
758 SCTP_ST_OTHER(SCTP_EVENT_NO_PENDING_TSN), 764 SCTP_ST_OTHER(SCTP_EVENT_NO_PENDING_TSN),
759 asoc->state, asoc->ep, asoc, NULL, 765 asoc->state, asoc->ep, asoc, NULL,
760 GFP_ATOMIC); 766 GFP_ATOMIC);
@@ -1042,6 +1048,8 @@ static int sctp_cmd_send_msg(struct sctp_association *asoc,
1042 */ 1048 */
1043static void sctp_cmd_send_asconf(struct sctp_association *asoc) 1049static void sctp_cmd_send_asconf(struct sctp_association *asoc)
1044{ 1050{
1051 struct net *net = sock_net(asoc->base.sk);
1052
1045 /* Send the next asconf chunk from the addip chunk 1053 /* Send the next asconf chunk from the addip chunk
1046 * queue. 1054 * queue.
1047 */ 1055 */
@@ -1053,7 +1061,7 @@ static void sctp_cmd_send_asconf(struct sctp_association *asoc)
1053 1061
1054 /* Hold the chunk until an ASCONF_ACK is received. */ 1062 /* Hold the chunk until an ASCONF_ACK is received. */
1055 sctp_chunk_hold(asconf); 1063 sctp_chunk_hold(asconf);
1056 if (sctp_primitive_ASCONF(asoc, asconf)) 1064 if (sctp_primitive_ASCONF(net, asoc, asconf))
1057 sctp_chunk_free(asconf); 1065 sctp_chunk_free(asconf);
1058 else 1066 else
1059 asoc->addip_last_asconf = asconf; 1067 asoc->addip_last_asconf = asconf;
@@ -1089,7 +1097,7 @@ static void sctp_cmd_send_asconf(struct sctp_association *asoc)
1089 * If you want to understand all of lksctp, this is a 1097 * If you want to understand all of lksctp, this is a
1090 * good place to start. 1098 * good place to start.
1091 */ 1099 */
1092int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype, 1100int sctp_do_sm(struct net *net, sctp_event_t event_type, sctp_subtype_t subtype,
1093 sctp_state_t state, 1101 sctp_state_t state,
1094 struct sctp_endpoint *ep, 1102 struct sctp_endpoint *ep,
1095 struct sctp_association *asoc, 1103 struct sctp_association *asoc,
@@ -1110,7 +1118,7 @@ int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype,
1110 /* Look up the state function, run it, and then process the 1118 /* Look up the state function, run it, and then process the
1111 * side effects. These three steps are the heart of lksctp. 1119 * side effects. These three steps are the heart of lksctp.
1112 */ 1120 */
1113 state_fn = sctp_sm_lookup_event(event_type, state, subtype); 1121 state_fn = sctp_sm_lookup_event(net, event_type, state, subtype);
1114 1122
1115 sctp_init_cmd_seq(&commands); 1123 sctp_init_cmd_seq(&commands);
1116 1124
diff --git a/net/sctp/sm_statetable.c b/net/sctp/sm_statetable.c
index 7c211a7f90f4..4a029d798287 100644
--- a/net/sctp/sm_statetable.c
+++ b/net/sctp/sm_statetable.c
@@ -59,7 +59,8 @@ other_event_table[SCTP_NUM_OTHER_TYPES][SCTP_STATE_NUM_STATES];
59static const sctp_sm_table_entry_t 59static const sctp_sm_table_entry_t
60timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES]; 60timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][SCTP_STATE_NUM_STATES];
61 61
62static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(sctp_cid_t cid, 62static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(struct net *net,
63 sctp_cid_t cid,
63 sctp_state_t state); 64 sctp_state_t state);
64 65
65 66
@@ -82,13 +83,14 @@ static const sctp_sm_table_entry_t bug = {
82 rtn; \ 83 rtn; \
83}) 84})
84 85
85const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type, 86const sctp_sm_table_entry_t *sctp_sm_lookup_event(struct net *net,
87 sctp_event_t event_type,
86 sctp_state_t state, 88 sctp_state_t state,
87 sctp_subtype_t event_subtype) 89 sctp_subtype_t event_subtype)
88{ 90{
89 switch (event_type) { 91 switch (event_type) {
90 case SCTP_EVENT_T_CHUNK: 92 case SCTP_EVENT_T_CHUNK:
91 return sctp_chunk_event_lookup(event_subtype.chunk, state); 93 return sctp_chunk_event_lookup(net, event_subtype.chunk, state);
92 case SCTP_EVENT_T_TIMEOUT: 94 case SCTP_EVENT_T_TIMEOUT:
93 return DO_LOOKUP(SCTP_EVENT_TIMEOUT_MAX, timeout, 95 return DO_LOOKUP(SCTP_EVENT_TIMEOUT_MAX, timeout,
94 timeout_event_table); 96 timeout_event_table);
@@ -906,7 +908,8 @@ static const sctp_sm_table_entry_t timeout_event_table[SCTP_NUM_TIMEOUT_TYPES][S
906 TYPE_SCTP_EVENT_TIMEOUT_AUTOCLOSE, 908 TYPE_SCTP_EVENT_TIMEOUT_AUTOCLOSE,
907}; 909};
908 910
909static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(sctp_cid_t cid, 911static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(struct net *net,
912 sctp_cid_t cid,
910 sctp_state_t state) 913 sctp_state_t state)
911{ 914{
912 if (state > SCTP_STATE_MAX) 915 if (state > SCTP_STATE_MAX)
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}