Skip to content

Commit 2f94aab

Browse files
nhormandavem330
authored andcommitted
sctp: refactor sctp_outq_teardown to insure proper re-initalization
Jamie Parsons reported a problem recently, in which the re-initalization of an association (The duplicate init case), resulted in a loss of receive window space. He tracked down the root cause to sctp_outq_teardown, which discarded all the data on an outq during a re-initalization of the corresponding association, but never reset the outq->outstanding_data field to zero. I wrote, and he tested this fix, which does a proper full re-initalization of the outq, fixing this problem, and hopefully future proofing us from simmilar issues down the road. Signed-off-by: Neil Horman <[email protected]> Reported-by: Jamie Parsons <[email protected]> Tested-by: Jamie Parsons <[email protected]> CC: Jamie Parsons <[email protected]> CC: Vlad Yasevich <[email protected]> CC: "David S. Miller" <[email protected]> CC: [email protected] Acked-by: Vlad Yasevich <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 01fe944 commit 2f94aab

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

net/sctp/outqueue.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q)
224224

225225
/* Free the outqueue structure and any related pending chunks.
226226
*/
227-
void sctp_outq_teardown(struct sctp_outq *q)
227+
static void __sctp_outq_teardown(struct sctp_outq *q)
228228
{
229229
struct sctp_transport *transport;
230230
struct list_head *lchunk, *temp;
@@ -277,20 +277,24 @@ void sctp_outq_teardown(struct sctp_outq *q)
277277
sctp_chunk_free(chunk);
278278
}
279279

280-
q->error = 0;
281-
282280
/* Throw away any leftover control chunks. */
283281
list_for_each_entry_safe(chunk, tmp, &q->control_chunk_list, list) {
284282
list_del_init(&chunk->list);
285283
sctp_chunk_free(chunk);
286284
}
287285
}
288286

287+
void sctp_outq_teardown(struct sctp_outq *q)
288+
{
289+
__sctp_outq_teardown(q);
290+
sctp_outq_init(q->asoc, q);
291+
}
292+
289293
/* Free the outqueue structure and any related pending chunks. */
290294
void sctp_outq_free(struct sctp_outq *q)
291295
{
292296
/* Throw away leftover chunks. */
293-
sctp_outq_teardown(q);
297+
__sctp_outq_teardown(q);
294298

295299
/* If we were kmalloc()'d, free the memory. */
296300
if (q->malloced)

0 commit comments

Comments
 (0)