Skip to content

Commit 3ecdda3

Browse files
lxindavem330
authored andcommitted
sctp: shrink stream outq when fails to do addstream reconf
When adding a stream with stream reconf, the new stream firstly is in CLOSED state but new out chunks can still be enqueued. Then once gets the confirmation from the peer, the state will change to OPEN. However, if the peer denies, it needs to roll back the stream. But when doing that, it only sets the stream outcnt back, and the chunks already in the new stream don't get purged. It caused these chunks can still be dequeued in sctp_outq_dequeue_data(). As its stream is still in CLOSE, the chunk will be enqueued to the head again by sctp_outq_head_data(). This chunk will never be sent out, and the chunks after it can never be dequeued. The assoc will be 'hung' in a dead loop of sending this chunk. To fix it, this patch is to purge these chunks already in the new stream by calling sctp_stream_shrink_out() when failing to do the addstream reconf. Fixes: 11ae76e ("sctp: implement receiver-side procedures for the Reconf Response Parameter") Reported-by: Ying Xu <[email protected]> Signed-off-by: Xin Long <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8f13399 commit 3ecdda3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

net/sctp/stream.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,11 +1044,13 @@ struct sctp_chunk *sctp_process_strreset_resp(
10441044
nums = ntohs(addstrm->number_of_streams);
10451045
number = stream->outcnt - nums;
10461046

1047-
if (result == SCTP_STRRESET_PERFORMED)
1047+
if (result == SCTP_STRRESET_PERFORMED) {
10481048
for (i = number; i < stream->outcnt; i++)
10491049
SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN;
1050-
else
1050+
} else {
1051+
sctp_stream_shrink_out(stream, number);
10511052
stream->outcnt = number;
1053+
}
10521054

10531055
*evp = sctp_ulpevent_make_stream_change_event(asoc, flags,
10541056
0, nums, GFP_ATOMIC);

0 commit comments

Comments
 (0)