[SCTP]: Verify some mandatory parameters.

Verify init_tag and a_rwnd mandatory parameters in INIT and
INIT-ACK chunks.

Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Vlad Yasevich and committed by David S. Miller d023f629 ebdfcad4

+3 -20
+3 -1
net/sctp/sm_make_chunk.c
··· 1775 1775 1776 1776 /* Verify stream values are non-zero. */ 1777 1777 if ((0 == peer_init->init_hdr.num_outbound_streams) || 1778 - (0 == peer_init->init_hdr.num_inbound_streams)) { 1778 + (0 == peer_init->init_hdr.num_inbound_streams) || 1779 + (0 == peer_init->init_hdr.init_tag) || 1780 + (SCTP_DEFAULT_MINWINDOW > ntohl(peer_init->init_hdr.a_rwnd))) { 1779 1781 1780 1782 sctp_process_inv_mandatory(asoc, chunk, errp); 1781 1783 return 0;
-19
net/sctp/sm_statefuns.c
··· 440 440 { 441 441 struct sctp_chunk *chunk = arg; 442 442 sctp_init_chunk_t *initchunk; 443 - __u32 init_tag; 444 443 struct sctp_chunk *err_chunk; 445 444 struct sctp_packet *packet; 446 445 sctp_error_t error; ··· 460 461 461 462 /* Grab the INIT header. */ 462 463 chunk->subh.init_hdr = (sctp_inithdr_t *) chunk->skb->data; 463 - 464 - init_tag = ntohl(chunk->subh.init_hdr->init_tag); 465 - 466 - /* Verification Tag: 3.3.3 467 - * If the value of the Initiate Tag in a received INIT ACK 468 - * chunk is found to be 0, the receiver MUST treat it as an 469 - * error and close the association by transmitting an ABORT. 470 - */ 471 - if (!init_tag) { 472 - struct sctp_chunk *reply = sctp_make_abort(asoc, chunk, 0); 473 - if (!reply) 474 - goto nomem; 475 - 476 - sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply)); 477 - return sctp_stop_t1_and_abort(commands, SCTP_ERROR_INV_PARAM, 478 - ECONNREFUSED, asoc, 479 - chunk->transport); 480 - } 481 464 482 465 /* Verify the INIT chunk before processing it. */ 483 466 err_chunk = NULL;