sctp: avoid flushing unsent queue when doing asoc reset
Now when doing asoc reset, it cleans up sacked and abandoned queues by calling sctp_outq_free where it also cleans up unsent, retransmit and transmitted queues. It's safe for the sender of response, as these 3 queues are empty at that time. But when the receiver of response is doing the reset, the users may already enqueue some chunks into unsent during the time waiting the response, and these chunks should not be flushed. To void the chunks in it would be removed, it moves the queue into a temp list, then gets it back after sctp_outq_free is done. The patch also fixes some incorrect comments in sctp_process_strreset_tsnreq. Signed-off-by: Xin Long <lucien.xin@gmail.com> Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
5c6144a0eb
commit
159f2a7456
@@ -747,9 +747,10 @@ struct sctp_chunk *sctp_process_strreset_tsnreq(
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* G3: The same processing as though a SACK chunk with no gap report
|
/* G4: The same processing as though a FWD-TSN chunk (as defined in
|
||||||
* and a cumulative TSN ACK of the Sender's Next TSN minus 1 were
|
* [RFC3758]) with all streams affected and a new cumulative TSN
|
||||||
* received MUST be performed.
|
* ACK of the Receiver's Next TSN minus 1 were received MUST be
|
||||||
|
* performed.
|
||||||
*/
|
*/
|
||||||
max_tsn_seen = sctp_tsnmap_get_max_tsn_seen(&asoc->peer.tsn_map);
|
max_tsn_seen = sctp_tsnmap_get_max_tsn_seen(&asoc->peer.tsn_map);
|
||||||
sctp_ulpq_reasm_flushtsn(&asoc->ulpq, max_tsn_seen);
|
sctp_ulpq_reasm_flushtsn(&asoc->ulpq, max_tsn_seen);
|
||||||
@@ -764,10 +765,9 @@ struct sctp_chunk *sctp_process_strreset_tsnreq(
|
|||||||
sctp_tsnmap_init(&asoc->peer.tsn_map, SCTP_TSN_MAP_INITIAL,
|
sctp_tsnmap_init(&asoc->peer.tsn_map, SCTP_TSN_MAP_INITIAL,
|
||||||
init_tsn, GFP_ATOMIC);
|
init_tsn, GFP_ATOMIC);
|
||||||
|
|
||||||
/* G4: The same processing as though a FWD-TSN chunk (as defined in
|
/* G3: The same processing as though a SACK chunk with no gap report
|
||||||
* [RFC3758]) with all streams affected and a new cumulative TSN
|
* and a cumulative TSN ACK of the Sender's Next TSN minus 1 were
|
||||||
* ACK of the Receiver's Next TSN minus 1 were received MUST be
|
* received MUST be performed.
|
||||||
* performed.
|
|
||||||
*/
|
*/
|
||||||
sctp_outq_free(&asoc->outqueue);
|
sctp_outq_free(&asoc->outqueue);
|
||||||
|
|
||||||
@@ -1021,6 +1021,7 @@ struct sctp_chunk *sctp_process_strreset_resp(
|
|||||||
if (result == SCTP_STRRESET_PERFORMED) {
|
if (result == SCTP_STRRESET_PERFORMED) {
|
||||||
__u32 mtsn = sctp_tsnmap_get_max_tsn_seen(
|
__u32 mtsn = sctp_tsnmap_get_max_tsn_seen(
|
||||||
&asoc->peer.tsn_map);
|
&asoc->peer.tsn_map);
|
||||||
|
LIST_HEAD(temp);
|
||||||
|
|
||||||
sctp_ulpq_reasm_flushtsn(&asoc->ulpq, mtsn);
|
sctp_ulpq_reasm_flushtsn(&asoc->ulpq, mtsn);
|
||||||
sctp_ulpq_abort_pd(&asoc->ulpq, GFP_ATOMIC);
|
sctp_ulpq_abort_pd(&asoc->ulpq, GFP_ATOMIC);
|
||||||
@@ -1029,7 +1030,13 @@ struct sctp_chunk *sctp_process_strreset_resp(
|
|||||||
SCTP_TSN_MAP_INITIAL,
|
SCTP_TSN_MAP_INITIAL,
|
||||||
stsn, GFP_ATOMIC);
|
stsn, GFP_ATOMIC);
|
||||||
|
|
||||||
|
/* Clean up sacked and abandoned queues only. As the
|
||||||
|
* out_chunk_list may not be empty, splice it to temp,
|
||||||
|
* then get it back after sctp_outq_free is done.
|
||||||
|
*/
|
||||||
|
list_splice_init(&asoc->outqueue.out_chunk_list, &temp);
|
||||||
sctp_outq_free(&asoc->outqueue);
|
sctp_outq_free(&asoc->outqueue);
|
||||||
|
list_splice_init(&temp, &asoc->outqueue.out_chunk_list);
|
||||||
|
|
||||||
asoc->next_tsn = rtsn;
|
asoc->next_tsn = rtsn;
|
||||||
asoc->ctsn_ack_point = asoc->next_tsn - 1;
|
asoc->ctsn_ack_point = asoc->next_tsn - 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user