* [PATCH] sctp: refactor sctp_outq_teardown to insure proper re-initalization
@ 2013-01-17 21:15 Neil Horman
2013-01-17 22:48 ` Vlad Yasevich
0 siblings, 1 reply; 3+ messages in thread
From: Neil Horman @ 2013-01-17 21:15 UTC (permalink / raw)
To: linux-sctp
Cc: Neil Horman, Jamie Parsons, Vlad Yasevich, David S. Miller,
netdev
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 <nhorman@tuxdriver.com>
Reported-by: Jamie Parsons <Jamie.Parsons@metaswitch.com>
Tested-by: Jamie Parsons <Jamie.Parsons@metaswitch.com>
CC: Jamie Parsons <Jamie.Parsons@metaswitch.com>
CC: Vlad Yasevich <vyasevich@gmail.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: netdev@vger.kernel.org
---
net/sctp/outqueue.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index 379c81d..9bcdbd0 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -224,7 +224,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;
@@ -277,8 +277,6 @@ void sctp_outq_teardown(struct sctp_outq *q)
sctp_chunk_free(chunk);
}
- q->error = 0;
-
/* Throw away any leftover control chunks. */
list_for_each_entry_safe(chunk, tmp, &q->control_chunk_list, list) {
list_del_init(&chunk->list);
@@ -286,11 +284,17 @@ void sctp_outq_teardown(struct sctp_outq *q)
}
}
+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)
--
1.7.11.7
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] sctp: refactor sctp_outq_teardown to insure proper re-initalization
2013-01-17 21:15 [PATCH] sctp: refactor sctp_outq_teardown to insure proper re-initalization Neil Horman
@ 2013-01-17 22:48 ` Vlad Yasevich
2013-01-17 23:40 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Vlad Yasevich @ 2013-01-17 22:48 UTC (permalink / raw)
To: Neil Horman; +Cc: linux-sctp, Jamie Parsons, David S. Miller, netdev
On 01/17/2013 04:15 PM, Neil Horman wrote:
> 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.
>
Good find.
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
-vlad
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> Reported-by: Jamie Parsons <Jamie.Parsons@metaswitch.com>
> Tested-by: Jamie Parsons <Jamie.Parsons@metaswitch.com>
> CC: Jamie Parsons <Jamie.Parsons@metaswitch.com>
> CC: Vlad Yasevich <vyasevich@gmail.com>
> CC: "David S. Miller" <davem@davemloft.net>
> CC: netdev@vger.kernel.org
> ---
> net/sctp/outqueue.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
> index 379c81d..9bcdbd0 100644
> --- a/net/sctp/outqueue.c
> +++ b/net/sctp/outqueue.c
> @@ -224,7 +224,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;
> @@ -277,8 +277,6 @@ void sctp_outq_teardown(struct sctp_outq *q)
> sctp_chunk_free(chunk);
> }
>
> - q->error = 0;
> -
> /* Throw away any leftover control chunks. */
> list_for_each_entry_safe(chunk, tmp, &q->control_chunk_list, list) {
> list_del_init(&chunk->list);
> @@ -286,11 +284,17 @@ void sctp_outq_teardown(struct sctp_outq *q)
> }
> }
>
> +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)
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sctp: refactor sctp_outq_teardown to insure proper re-initalization
2013-01-17 22:48 ` Vlad Yasevich
@ 2013-01-17 23:40 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2013-01-17 23:40 UTC (permalink / raw)
To: vyasevich; +Cc: nhorman, linux-sctp, Jamie.Parsons, netdev
From: Vlad Yasevich <vyasevich@gmail.com>
Date: Thu, 17 Jan 2013 17:48:20 -0500
> On 01/17/2013 04:15 PM, Neil Horman wrote:
>> 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.
>>
>
> Good find.
>
> Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Applied and queued up for -stable, thanks everyone.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-17 23:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-17 21:15 [PATCH] sctp: refactor sctp_outq_teardown to insure proper re-initalization Neil Horman
2013-01-17 22:48 ` Vlad Yasevich
2013-01-17 23:40 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).