Skip to content

Commit

Permalink
sctp: improve the events for sctp stream adding
Browse files Browse the repository at this point in the history
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: 50a4159 ("sctp: implement receiver-side procedures for the Add Outgoing Streams Request Parameter")
Fixes: c5c4ebb ("sctp: implement receiver-side procedures for the Add Incoming Streams Request Parameter")
Reported-by: Ying Xu <yinxu@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Xin Long authored and David S. Miller committed Jan 25, 2019
1 parent 2e6dc4d commit 8220c87
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions net/sctp/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,14 @@ struct sctp_chunk *sctp_process_strreset_addstrm_out(
if (!(asoc->strreset_enable & SCTP_ENABLE_CHANGE_ASSOC_REQ))
goto out;

in = ntohs(addstrm->number_of_streams);
incnt = stream->incnt + in;
if (!in || incnt > SCTP_MAX_STREAM)
goto out;

if (sctp_stream_alloc_in(stream, incnt, GFP_ATOMIC))
goto out;

if (asoc->strreset_chunk) {
if (!sctp_chunk_lookup_strreset_param(
asoc, 0, SCTP_PARAM_RESET_ADD_IN_STREAMS)) {
Expand All @@ -889,14 +897,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;

if (sctp_stream_alloc_in(stream, incnt, GFP_ATOMIC))
goto out;

stream->incnt = incnt;

result = SCTP_STRRESET_PERFORMED;
Expand Down Expand Up @@ -966,9 +966,6 @@ struct sctp_chunk *sctp_process_strreset_addstrm_in(

result = SCTP_STRRESET_PERFORMED;

*evp = sctp_ulpevent_make_stream_change_event(asoc,
0, 0, ntohs(addstrm->number_of_streams), GFP_ATOMIC);

out:
sctp_update_strreset_result(asoc, result);
err:
Expand Down

0 comments on commit 8220c87

Please sign in to comment.