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 264 struct sctp_chunk *err_chunk; 265 265 struct sctp_packet *packet; 266 266 sctp_unrecognized_param_t *unk_param; 267 - struct sock *sk; 268 267 int len; 269 268 270 269 /* 6.10 Bundling ··· 282 283 * control endpoint, respond with an ABORT. 283 284 */ 284 285 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 286 return sctp_sf_tabort_8_4_8(ep, asoc, type, arg, commands); 296 287 297 288 /* 3.1 A packet containing an INIT chunk MUST have a zero Verification ··· 579 590 struct sctp_ulpevent *ev, *ai_ev = NULL; 580 591 int error = 0; 581 592 struct sctp_chunk *err_chk_p; 593 + struct sock *sk; 582 594 583 595 /* If the packet is an OOTB packet which is temporarily on the 584 596 * control endpoint, respond with an ABORT. ··· 594 604 */ 595 605 if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) 596 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); 597 616 598 617 /* "Decode" the chunk. We have no optional parameters so we 599 618 * are in good shape.