Browse files

sctp: refactor sctp_outq_teardown to insure proper re-initalization

[ Upstream commit 2f94aabd9f6c925d77aecb3ff020f1cc12ed8f86 ]

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 <>
Reported-by: Jamie Parsons <>
Tested-by: Jamie Parsons <>
CC: Jamie Parsons <>
CC: Vlad Yasevich <>
CC: "David S. Miller" <>
Acked-by: Vlad Yasevich <>
Signed-off-by: David S. Miller <>
Signed-off-by: Greg Kroah-Hartman <>
  • Loading branch information...
1 parent b4129da commit 4c921d0ed5d49a93613530f4dd405fc2db3ccb84 Neil Horman committed with gregkh Jan 17, 2013
Showing with 8 additions and 4 deletions.
  1. +8 −4 net/sctp/outqueue.c
12 net/sctp/outqueue.c
@@ -223,7 +223,7 @@ void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q)
/* Free the outqueue structure and any related pending chunks.
-void sctp_outq_teardown(struct sctp_outq *q)
+static void __sctp_outq_teardown(struct sctp_outq *q)
struct sctp_transport *transport;
struct list_head *lchunk, *temp;
@@ -276,20 +276,24 @@ void sctp_outq_teardown(struct sctp_outq *q)
- q->error = 0;
/* Throw away any leftover control chunks. */
list_for_each_entry_safe(chunk, tmp, &q->control_chunk_list, list) {
+void sctp_outq_teardown(struct sctp_outq *q)
+ __sctp_outq_teardown(q);
+ sctp_outq_init(q->asoc, q);
/* Free the outqueue structure and any related pending chunks. */
void sctp_outq_free(struct sctp_outq *q)
/* Throw away leftover chunks. */
- sctp_outq_teardown(q);
+ __sctp_outq_teardown(q);
/* If we were kmalloc()'d, free the memory. */
if (q->malloced)

0 comments on commit 4c921d0

Please sign in to comment.