aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sctp/stream.c')
-rw-r--r--net/sctp/stream.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/net/sctp/stream.c b/net/sctp/stream.c
index 63ea15503714..fa8371ff05c4 100644
--- a/net/sctp/stream.c
+++ b/net/sctp/stream.c
@@ -118,6 +118,7 @@ int sctp_send_reset_streams(struct sctp_association *asoc,
118 __u16 i, str_nums, *str_list; 118 __u16 i, str_nums, *str_list;
119 struct sctp_chunk *chunk; 119 struct sctp_chunk *chunk;
120 int retval = -EINVAL; 120 int retval = -EINVAL;
121 __be16 *nstr_list;
121 bool out, in; 122 bool out, in;
122 123
123 if (!asoc->peer.reconf_capable || 124 if (!asoc->peer.reconf_capable ||
@@ -148,13 +149,18 @@ int sctp_send_reset_streams(struct sctp_association *asoc,
148 if (str_list[i] >= stream->incnt) 149 if (str_list[i] >= stream->incnt)
149 goto out; 150 goto out;
150 151
152 nstr_list = kcalloc(str_nums, sizeof(__be16), GFP_KERNEL);
153 if (!nstr_list) {
154 retval = -ENOMEM;
155 goto out;
156 }
157
151 for (i = 0; i < str_nums; i++) 158 for (i = 0; i < str_nums; i++)
152 str_list[i] = htons(str_list[i]); 159 nstr_list[i] = htons(str_list[i]);
153 160
154 chunk = sctp_make_strreset_req(asoc, str_nums, str_list, out, in); 161 chunk = sctp_make_strreset_req(asoc, str_nums, nstr_list, out, in);
155 162
156 for (i = 0; i < str_nums; i++) 163 kfree(nstr_list);
157 str_list[i] = ntohs(str_list[i]);
158 164
159 if (!chunk) { 165 if (!chunk) {
160 retval = -ENOMEM; 166 retval = -ENOMEM;
@@ -305,7 +311,7 @@ out:
305} 311}
306 312
307static struct sctp_paramhdr *sctp_chunk_lookup_strreset_param( 313static struct sctp_paramhdr *sctp_chunk_lookup_strreset_param(
308 struct sctp_association *asoc, __u32 resp_seq, 314 struct sctp_association *asoc, __be32 resp_seq,
309 __be16 type) 315 __be16 type)
310{ 316{
311 struct sctp_chunk *chunk = asoc->strreset_chunk; 317 struct sctp_chunk *chunk = asoc->strreset_chunk;
@@ -345,8 +351,9 @@ struct sctp_chunk *sctp_process_strreset_outreq(
345{ 351{
346 struct sctp_strreset_outreq *outreq = param.v; 352 struct sctp_strreset_outreq *outreq = param.v;
347 struct sctp_stream *stream = &asoc->stream; 353 struct sctp_stream *stream = &asoc->stream;
348 __u16 i, nums, flags = 0, *str_p = NULL;
349 __u32 result = SCTP_STRRESET_DENIED; 354 __u32 result = SCTP_STRRESET_DENIED;
355 __u16 i, nums, flags = 0;
356 __be16 *str_p = NULL;
350 __u32 request_seq; 357 __u32 request_seq;
351 358
352 request_seq = ntohl(outreq->request_seq); 359 request_seq = ntohl(outreq->request_seq);
@@ -439,8 +446,9 @@ struct sctp_chunk *sctp_process_strreset_inreq(
439 struct sctp_stream *stream = &asoc->stream; 446 struct sctp_stream *stream = &asoc->stream;
440 __u32 result = SCTP_STRRESET_DENIED; 447 __u32 result = SCTP_STRRESET_DENIED;
441 struct sctp_chunk *chunk = NULL; 448 struct sctp_chunk *chunk = NULL;
442 __u16 i, nums, *str_p;
443 __u32 request_seq; 449 __u32 request_seq;
450 __u16 i, nums;
451 __be16 *str_p;
444 452
445 request_seq = ntohl(inreq->request_seq); 453 request_seq = ntohl(inreq->request_seq);
446 if (TSN_lt(asoc->strreset_inseq, request_seq) || 454 if (TSN_lt(asoc->strreset_inseq, request_seq) ||
@@ -769,7 +777,7 @@ struct sctp_chunk *sctp_process_strreset_resp(
769 777
770 if (req->type == SCTP_PARAM_RESET_OUT_REQUEST) { 778 if (req->type == SCTP_PARAM_RESET_OUT_REQUEST) {
771 struct sctp_strreset_outreq *outreq; 779 struct sctp_strreset_outreq *outreq;
772 __u16 *str_p; 780 __be16 *str_p;
773 781
774 outreq = (struct sctp_strreset_outreq *)req; 782 outreq = (struct sctp_strreset_outreq *)req;
775 str_p = outreq->list_of_streams; 783 str_p = outreq->list_of_streams;
@@ -794,7 +802,7 @@ struct sctp_chunk *sctp_process_strreset_resp(
794 nums, str_p, GFP_ATOMIC); 802 nums, str_p, GFP_ATOMIC);
795 } else if (req->type == SCTP_PARAM_RESET_IN_REQUEST) { 803 } else if (req->type == SCTP_PARAM_RESET_IN_REQUEST) {
796 struct sctp_strreset_inreq *inreq; 804 struct sctp_strreset_inreq *inreq;
797 __u16 *str_p; 805 __be16 *str_p;
798 806
799 /* if the result is performed, it's impossible for inreq */ 807 /* if the result is performed, it's impossible for inreq */
800 if (result == SCTP_STRRESET_PERFORMED) 808 if (result == SCTP_STRRESET_PERFORMED)