Commit f97e7856 authored by Xin Long's avatar Xin Long Committed by Greg Kroah-Hartman

sctp: improve the events for sctp stream adding

[ Upstream commit 8220c870 ]

This patch is to improve sctp stream adding events in 2 places:

  1. In sctp_process_strreset_addstrm_out(), move up SCTP_MAX_STREAM
     and in stream allocation failure checks, as the adding has to
     succeed after reconf_timer stops for the in stream adding
     request retransmission.

  3. In sctp_process_strreset_addstrm_in(), no event should be sent,
     as no in or out stream is added here.

Fixes: 50a41591 ("sctp: implement receiver-side procedures for the Add Outgoing Streams Request Parameter")
Fixes: c5c4ebb3 ("sctp: implement receiver-side procedures for the Add Incoming Streams Request Parameter")
Reported-by: default avatarYing Xu <yinxu@redhat.com>
Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 25d497c3
...@@ -642,6 +642,16 @@ struct sctp_chunk *sctp_process_strreset_addstrm_out( ...@@ -642,6 +642,16 @@ struct sctp_chunk *sctp_process_strreset_addstrm_out(
if (!(asoc->strreset_enable & SCTP_ENABLE_CHANGE_ASSOC_REQ)) if (!(asoc->strreset_enable & SCTP_ENABLE_CHANGE_ASSOC_REQ))
goto out; goto out;
in = ntohs(addstrm->number_of_streams);
incnt = stream->incnt + in;
if (!in || incnt > SCTP_MAX_STREAM)
goto out;
streamin = krealloc(stream->in, incnt * sizeof(*streamin),
GFP_ATOMIC);
if (!streamin)
goto out;
if (asoc->strreset_chunk) { if (asoc->strreset_chunk) {
if (!sctp_chunk_lookup_strreset_param( if (!sctp_chunk_lookup_strreset_param(
asoc, 0, SCTP_PARAM_RESET_ADD_IN_STREAMS)) { asoc, 0, SCTP_PARAM_RESET_ADD_IN_STREAMS)) {
...@@ -665,16 +675,6 @@ struct sctp_chunk *sctp_process_strreset_addstrm_out( ...@@ -665,16 +675,6 @@ struct sctp_chunk *sctp_process_strreset_addstrm_out(
} }
} }
in = ntohs(addstrm->number_of_streams);
incnt = stream->incnt + in;
if (!in || incnt > SCTP_MAX_STREAM)
goto out;
streamin = krealloc(stream->in, incnt * sizeof(*streamin),
GFP_ATOMIC);
if (!streamin)
goto out;
memset(streamin + stream->incnt, 0, in * sizeof(*streamin)); memset(streamin + stream->incnt, 0, in * sizeof(*streamin));
stream->in = streamin; stream->in = streamin;
stream->incnt = incnt; stream->incnt = incnt;
...@@ -750,9 +750,6 @@ struct sctp_chunk *sctp_process_strreset_addstrm_in( ...@@ -750,9 +750,6 @@ struct sctp_chunk *sctp_process_strreset_addstrm_in(
result = SCTP_STRRESET_PERFORMED; result = SCTP_STRRESET_PERFORMED;
*evp = sctp_ulpevent_make_stream_change_event(asoc,
0, 0, ntohs(addstrm->number_of_streams), GFP_ATOMIC);
out: out:
sctp_update_strreset_result(asoc, result); sctp_update_strreset_result(asoc, result);
err: err:
......
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