Commit aca9dc23 authored by Sridhar Samudrala's avatar Sridhar Samudrala

[SCTP] Fix a couple of issues with the call to sctp_ssnmap_new() in

sctp_process_init().

The argument passed as inbound streams to sctp_ssnmap_new() is
incorrect. Also allocating a ssnmap everytime a INIT is received is
vulnerable to DoS attacks. So delay the creation of an ssnmap if we
are processing a temporary association. 
parent 54eca890
......@@ -1813,11 +1813,14 @@ int sctp_process_init(struct sctp_association *asoc, sctp_cid_t cid,
* stream sequence number shall be set to 0.
*/
/* Allocate storage for the negotiated streams. */
asoc->ssnmap = sctp_ssnmap_new(asoc->peer.i.num_outbound_streams,
/* Allocate storage for the negotiated streams if it is not a temporary * association.
*/
if (!asoc->temp) {
asoc->ssnmap = sctp_ssnmap_new(asoc->c.sinit_max_instreams,
asoc->c.sinit_num_ostreams, gfp);
if (!asoc->ssnmap)
goto nomem_ssnmap;
}
/* ADDIP Section 4.1 ASCONF Chunk Procedures
*
......
......@@ -1435,7 +1435,7 @@ static int sctp_setsockopt_initmsg(struct sock *sk, char *optval, int optlen)
}
/*
* 7.1.14 Set default send parameters (SET_DEFAULT_SEND_PARAM)
* 7.1.14 Set default send parameters (SCTP_DEFAULT_SEND_PARAM)
*
* Applications that wish to use the sendto() system call may wish to
* specify a default set of parameters that would normally be supplied
......@@ -2072,9 +2072,8 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk)
return -ESOCKTNOSUPPORT;
}
/* FIXME: The next draft (04) of the SCTP Sockets Extensions
* should include a socket option for manipulating these
* message parameters (and a few others).
/* Initialize default send parameters. These parameters can be
* modified with the SCTP_DEFAULT_SEND_PARAM socket option.
*/
sp->default_stream = 0;
sp->default_ppid = 0;
......@@ -2093,7 +2092,6 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk)
/* Initialize default RTO related parameters. These parameters can
* be modified for with the SCTP_RTOINFO socket option.
* FIXME: These are not used yet.
*/
sp->rtoinfo.srto_initial = (sctp_rto_initial / HZ) * 1000;
sp->rtoinfo.srto_max = (sctp_rto_max / HZ) * 1000;
......@@ -2776,7 +2774,7 @@ static int sctp_getsockopt_primary_addr(struct sock *sk, int len,
/*
*
* 7.1.14 Set default send parameters (SET_DEFAULT_SEND_PARAM)
* 7.1.14 Set default send parameters (SCTP_DEFAULT_SEND_PARAM)
*
* Applications that wish to use the sendto() system call may wish to
* specify a default set of parameters that would normally be supplied
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment