diff options
Diffstat (limited to 'net/sctp/sm_sideeffect.c')
-rw-r--r-- | net/sctp/sm_sideeffect.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index fe99628e1257..bcfebb91559d 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: | |||
291 | static void sctp_generate_timeout_event(struct sctp_association *asoc, | 292 | static 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 | */ |
1043 | static void sctp_cmd_send_asconf(struct sctp_association *asoc) | 1049 | static 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 | */ |
1092 | int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype, | 1100 | int 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,12 +1118,12 @@ 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 | ||
1117 | DEBUG_PRE; | 1125 | DEBUG_PRE; |
1118 | status = (*state_fn->fn)(ep, asoc, subtype, event_arg, &commands); | 1126 | status = (*state_fn->fn)(net, ep, asoc, subtype, event_arg, &commands); |
1119 | DEBUG_POST; | 1127 | DEBUG_POST; |
1120 | 1128 | ||
1121 | error = sctp_side_effects(event_type, subtype, state, | 1129 | error = sctp_side_effects(event_type, subtype, state, |