SCTP: Abort on COOKIE-ECHO if backlog is exceeded.

Currently we abort on the INIT chunk we our backlog is currenlty
exceeded. Delay this about untill COOKIE-ECHO to give the user
time to accept the socket. Also, make sure that we treat
sk_max_backlog of 0 as no connections allowed.

Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>

+10 -11
+10 -11
net/sctp/sm_statefuns.c
··· 264 struct sctp_chunk *err_chunk; 265 struct sctp_packet *packet; 266 sctp_unrecognized_param_t *unk_param; 267 - struct sock *sk; 268 int len; 269 270 /* 6.10 Bundling ··· 282 * control endpoint, respond with an ABORT. 283 */ 284 if (ep == sctp_sk((sctp_get_ctl_sock()))->ep) 285 - return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands); 286 - 287 - sk = ep->base.sk; 288 - /* If the endpoint is not listening or if the number of associations 289 - * on the TCP-style socket exceed the max backlog, respond with an 290 - * ABORT. 291 - */ 292 - if (!sctp_sstate(sk, LISTENING) || 293 - (sctp_style(sk, TCP) && 294 - sk_acceptq_is_full(sk))) 295 return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands); 296 297 /* 3.1 A packet containing an INIT chunk MUST have a zero Verification ··· 579 struct sctp_ulpevent *ev, *ai_ev = NULL; 580 int error = 0; 581 struct sctp_chunk *err_chk_p; 582 583 /* If the packet is an OOTB packet which is temporarily on the 584 * control endpoint, respond with an ABORT. ··· 594 */ 595 if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) 596 return sctp_sf_pdiscard(ep, asoc, type, arg, commands); 597 598 /* "Decode" the chunk. We have no optional parameters so we 599 * are in good shape.
··· 264 struct sctp_chunk *err_chunk; 265 struct sctp_packet *packet; 266 sctp_unrecognized_param_t *unk_param; 267 int len; 268 269 /* 6.10 Bundling ··· 283 * control endpoint, respond with an ABORT. 284 */ 285 if (ep == sctp_sk((sctp_get_ctl_sock()))->ep) 286 return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands); 287 288 /* 3.1 A packet containing an INIT chunk MUST have a zero Verification ··· 590 struct sctp_ulpevent *ev, *ai_ev = NULL; 591 int error = 0; 592 struct sctp_chunk *err_chk_p; 593 + struct sock *sk; 594 595 /* If the packet is an OOTB packet which is temporarily on the 596 * control endpoint, respond with an ABORT. ··· 604 */ 605 if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) 606 return sctp_sf_pdiscard(ep, asoc, type, arg, commands); 607 + 608 + /* If the endpoint is not listening or if the number of associations 609 + * on the TCP-style socket exceed the max backlog, respond with an 610 + * ABORT. 611 + */ 612 + sk = ep->base.sk; 613 + if (!sctp_sstate(sk, LISTENING) || 614 + (sctp_style(sk, TCP) && sk_acceptq_is_full(sk))) 615 + return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands); 616 617 /* "Decode" the chunk. We have no optional parameters so we 618 * are in good shape.