aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/sctp/sm_make_chunk.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 17cb400ecd6a..f6fc5c1a4078 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -208,7 +208,8 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
208 sp = sctp_sk(asoc->base.sk); 208 sp = sctp_sk(asoc->base.sk);
209 num_types = sp->pf->supported_addrs(sp, types); 209 num_types = sp->pf->supported_addrs(sp, types);
210 210
211 chunksize = sizeof(init) + addrs_len + SCTP_SAT_LEN(num_types); 211 chunksize = sizeof(init) + addrs_len;
212 chunksize += WORD_ROUND(SCTP_SAT_LEN(num_types));
212 chunksize += sizeof(ecap_param); 213 chunksize += sizeof(ecap_param);
213 214
214 if (sctp_prsctp_enable) 215 if (sctp_prsctp_enable)
@@ -238,14 +239,14 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
238 /* Add HMACS parameter length if any were defined */ 239 /* Add HMACS parameter length if any were defined */
239 auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs; 240 auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs;
240 if (auth_hmacs->length) 241 if (auth_hmacs->length)
241 chunksize += ntohs(auth_hmacs->length); 242 chunksize += WORD_ROUND(ntohs(auth_hmacs->length));
242 else 243 else
243 auth_hmacs = NULL; 244 auth_hmacs = NULL;
244 245
245 /* Add CHUNKS parameter length */ 246 /* Add CHUNKS parameter length */
246 auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks; 247 auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks;
247 if (auth_chunks->length) 248 if (auth_chunks->length)
248 chunksize += ntohs(auth_chunks->length); 249 chunksize += WORD_ROUND(ntohs(auth_chunks->length));
249 else 250 else
250 auth_chunks = NULL; 251 auth_chunks = NULL;
251 252
@@ -255,7 +256,8 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
255 256
256 /* If we have any extensions to report, account for that */ 257 /* If we have any extensions to report, account for that */
257 if (num_ext) 258 if (num_ext)
258 chunksize += sizeof(sctp_supported_ext_param_t) + num_ext; 259 chunksize += WORD_ROUND(sizeof(sctp_supported_ext_param_t) +
260 num_ext);
259 261
260 /* RFC 2960 3.3.2 Initiation (INIT) (1) 262 /* RFC 2960 3.3.2 Initiation (INIT) (1)
261 * 263 *
@@ -397,13 +399,13 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
397 399
398 auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs; 400 auth_hmacs = (sctp_paramhdr_t *)asoc->c.auth_hmacs;
399 if (auth_hmacs->length) 401 if (auth_hmacs->length)
400 chunksize += ntohs(auth_hmacs->length); 402 chunksize += WORD_ROUND(ntohs(auth_hmacs->length));
401 else 403 else
402 auth_hmacs = NULL; 404 auth_hmacs = NULL;
403 405
404 auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks; 406 auth_chunks = (sctp_paramhdr_t *)asoc->c.auth_chunks;
405 if (auth_chunks->length) 407 if (auth_chunks->length)
406 chunksize += ntohs(auth_chunks->length); 408 chunksize += WORD_ROUND(ntohs(auth_chunks->length));
407 else 409 else
408 auth_chunks = NULL; 410 auth_chunks = NULL;
409 411
@@ -412,7 +414,8 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
412 } 414 }
413 415
414 if (num_ext) 416 if (num_ext)
415 chunksize += sizeof(sctp_supported_ext_param_t) + num_ext; 417 chunksize += WORD_ROUND(sizeof(sctp_supported_ext_param_t) +
418 num_ext);
416 419
417 /* Now allocate and fill out the chunk. */ 420 /* Now allocate and fill out the chunk. */
418 retval = sctp_make_chunk(asoc, SCTP_CID_INIT_ACK, 0, chunksize); 421 retval = sctp_make_chunk(asoc, SCTP_CID_INIT_ACK, 0, chunksize);