All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Xin Long <lucien.xin@gmail.com>
Cc: network dev <netdev@vger.kernel.org>,
	linux-sctp@vger.kernel.org, Neil Horman <nhorman@tuxdriver.com>,
	Vlad Yasevich <vyasevich@gmail.com>,
	davem@davemloft.net
Subject: Re: [PATCHv6 net-next 2/6] sctp: streams should be recovered when it fails to send request.
Date: Wed, 08 Feb 2017 21:56:34 +0000	[thread overview]
Message-ID: <20170208215633.GI3414@localhost.localdomain> (raw)
In-Reply-To: <3d1180fcc5c72dea7d6cb7c7fafae4c4a7782cb3.1486573728.git.lucien.xin@gmail.com>

On Thu, Feb 09, 2017 at 01:18:16AM +0800, Xin Long wrote:
> Now when sending stream reset request, it closes the streams to
> block further xmit of data until this request is completed, then
> calls sctp_send_reconf to send the chunk.
> 
> But if sctp_send_reconf returns err, and it doesn't recover the
> streams' states back,  which means the request chunk would not be
> queued and sent, so the asoc will get stuck, streams are closed
> and no packet is even queued.
> 
> This patch is to fix it by recovering the streams' states when
> it fails to send the request, it is also to fix a return value.
> 
> Fixes: 7f9d68ac944e ("sctp: implement sender-side procedures for SSN Reset Request Parameter")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

> ---
>  net/sctp/stream.c | 19 +++++++++++++++++--
>  1 file changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/net/sctp/stream.c b/net/sctp/stream.c
> index 13d5e07..6a686e3 100644
> --- a/net/sctp/stream.c
> +++ b/net/sctp/stream.c
> @@ -136,8 +136,10 @@ int sctp_send_reset_streams(struct sctp_association *asoc,
>  				goto out;
>  
>  	chunk = sctp_make_strreset_req(asoc, str_nums, str_list, out, in);
> -	if (!chunk)
> +	if (!chunk) {
> +		retval = -ENOMEM;
>  		goto out;
> +	}
>  
>  	if (out) {
>  		if (str_nums)
> @@ -149,7 +151,6 @@ int sctp_send_reset_streams(struct sctp_association *asoc,
>  				stream->out[i].state = SCTP_STREAM_CLOSED;
>  	}
>  
> -	asoc->strreset_outstanding = out + in;
>  	asoc->strreset_chunk = chunk;
>  	sctp_chunk_hold(asoc->strreset_chunk);
>  
> @@ -157,8 +158,22 @@ int sctp_send_reset_streams(struct sctp_association *asoc,
>  	if (retval) {
>  		sctp_chunk_put(asoc->strreset_chunk);
>  		asoc->strreset_chunk = NULL;
> +		if (!out)
> +			goto out;
> +
> +		if (str_nums)
> +			for (i = 0; i < str_nums; i++)
> +				stream->out[str_list[i]].state > +						       SCTP_STREAM_OPEN;
> +		else
> +			for (i = 0; i < stream->outcnt; i++)
> +				stream->out[i].state = SCTP_STREAM_OPEN;
> +
> +		goto out;
>  	}
>  
> +	asoc->strreset_outstanding = out + in;
> +
>  out:
>  	return retval;
>  }
> -- 
> 2.1.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

WARNING: multiple messages have this Message-ID (diff)
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Xin Long <lucien.xin@gmail.com>
Cc: network dev <netdev@vger.kernel.org>,
	linux-sctp@vger.kernel.org, Neil Horman <nhorman@tuxdriver.com>,
	Vlad Yasevich <vyasevich@gmail.com>,
	davem@davemloft.net
Subject: Re: [PATCHv6 net-next 2/6] sctp: streams should be recovered when it fails to send request.
Date: Wed, 8 Feb 2017 19:56:34 -0200	[thread overview]
Message-ID: <20170208215633.GI3414@localhost.localdomain> (raw)
In-Reply-To: <3d1180fcc5c72dea7d6cb7c7fafae4c4a7782cb3.1486573728.git.lucien.xin@gmail.com>

On Thu, Feb 09, 2017 at 01:18:16AM +0800, Xin Long wrote:
> Now when sending stream reset request, it closes the streams to
> block further xmit of data until this request is completed, then
> calls sctp_send_reconf to send the chunk.
> 
> But if sctp_send_reconf returns err, and it doesn't recover the
> streams' states back,  which means the request chunk would not be
> queued and sent, so the asoc will get stuck, streams are closed
> and no packet is even queued.
> 
> This patch is to fix it by recovering the streams' states when
> it fails to send the request, it is also to fix a return value.
> 
> Fixes: 7f9d68ac944e ("sctp: implement sender-side procedures for SSN Reset Request Parameter")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

> ---
>  net/sctp/stream.c | 19 +++++++++++++++++--
>  1 file changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/net/sctp/stream.c b/net/sctp/stream.c
> index 13d5e07..6a686e3 100644
> --- a/net/sctp/stream.c
> +++ b/net/sctp/stream.c
> @@ -136,8 +136,10 @@ int sctp_send_reset_streams(struct sctp_association *asoc,
>  				goto out;
>  
>  	chunk = sctp_make_strreset_req(asoc, str_nums, str_list, out, in);
> -	if (!chunk)
> +	if (!chunk) {
> +		retval = -ENOMEM;
>  		goto out;
> +	}
>  
>  	if (out) {
>  		if (str_nums)
> @@ -149,7 +151,6 @@ int sctp_send_reset_streams(struct sctp_association *asoc,
>  				stream->out[i].state = SCTP_STREAM_CLOSED;
>  	}
>  
> -	asoc->strreset_outstanding = out + in;
>  	asoc->strreset_chunk = chunk;
>  	sctp_chunk_hold(asoc->strreset_chunk);
>  
> @@ -157,8 +158,22 @@ int sctp_send_reset_streams(struct sctp_association *asoc,
>  	if (retval) {
>  		sctp_chunk_put(asoc->strreset_chunk);
>  		asoc->strreset_chunk = NULL;
> +		if (!out)
> +			goto out;
> +
> +		if (str_nums)
> +			for (i = 0; i < str_nums; i++)
> +				stream->out[str_list[i]].state =
> +						       SCTP_STREAM_OPEN;
> +		else
> +			for (i = 0; i < stream->outcnt; i++)
> +				stream->out[i].state = SCTP_STREAM_OPEN;
> +
> +		goto out;
>  	}
>  
> +	asoc->strreset_outstanding = out + in;
> +
>  out:
>  	return retval;
>  }
> -- 
> 2.1.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  parent reply	other threads:[~2017-02-08 21:56 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-08 17:18 [PATCHv6 net-next 0/6] sctp: add sender-side procedures for stream reconf asoc reset and add streams Xin Long
2017-02-08 17:18 ` Xin Long
2017-02-08 17:18 ` [PATCHv6 net-next 1/6] sctp: drop unnecessary __packed from some stream reconf structures Xin Long
2017-02-08 17:18   ` Xin Long
2017-02-08 17:18   ` [PATCHv6 net-next 2/6] sctp: streams should be recovered when it fails to send request Xin Long
2017-02-08 17:18     ` Xin Long
2017-02-08 17:18     ` [PATCHv6 net-next 3/6] sctp: add support for generating stream reconf ssn/tsn reset request chunk Xin Long
2017-02-08 17:18       ` Xin Long
2017-02-08 17:18       ` [PATCHv6 net-next 4/6] sctp: implement sender-side procedures for SSN/TSN Reset Request Parameter Xin Long
2017-02-08 17:18         ` Xin Long
2017-02-08 17:18         ` [PATCHv6 net-next 5/6] sctp: add support for generating stream reconf add incoming/outgoing streams Xin Long
2017-02-08 17:18           ` [PATCHv6 net-next 5/6] sctp: add support for generating stream reconf add incoming/outgoing streams request chunk Xin Long
2017-02-08 17:18           ` [PATCHv6 net-next 6/6] sctp: implement sender-side procedures for Add Incoming/Outgoing Streams Requ Xin Long
2017-02-08 17:18             ` [PATCHv6 net-next 6/6] sctp: implement sender-side procedures for Add Incoming/Outgoing Streams Request Parameter Xin Long
2017-02-09 11:24             ` [PATCHv6 net-next 6/6] sctp: implement sender-side procedures for Add Incoming/Outgoing Streams Marcelo Ricardo Leitner
2017-02-09 11:24               ` [PATCHv6 net-next 6/6] sctp: implement sender-side procedures for Add Incoming/Outgoing Streams Request Parameter Marcelo Ricardo Leitner
2017-02-09 11:23           ` [PATCHv6 net-next 5/6] sctp: add support for generating stream reconf add incoming/outgoing stre Marcelo Ricardo Leitner
2017-02-09 11:23             ` [PATCHv6 net-next 5/6] sctp: add support for generating stream reconf add incoming/outgoing streams request chunk Marcelo Ricardo Leitner
2017-02-08 21:48         ` [PATCHv6 net-next 4/6] sctp: implement sender-side procedures for SSN/TSN Reset Request Paramete Marcelo Ricardo Leitner
2017-02-08 21:48           ` [PATCHv6 net-next 4/6] sctp: implement sender-side procedures for SSN/TSN Reset Request Parameter Marcelo Ricardo Leitner
2017-02-08 21:50           ` [PATCHv6 net-next 4/6] sctp: implement sender-side procedures for SSN/TSN Reset Request Paramete Marcelo Ricardo Leitner
2017-02-08 21:50             ` [PATCHv6 net-next 4/6] sctp: implement sender-side procedures for SSN/TSN Reset Request Parameter Marcelo Ricardo Leitner
2017-02-09  7:58             ` [PATCHv6 net-next 4/6] sctp: implement sender-side procedures for SSN/TSN Reset Request Paramete Xin Long
2017-02-09  7:58               ` [PATCHv6 net-next 4/6] sctp: implement sender-side procedures for SSN/TSN Reset Request Parameter Xin Long
2017-02-09 11:23         ` [PATCHv6 net-next 4/6] sctp: implement sender-side procedures for SSN/TSN Reset Request Paramete Marcelo Ricardo Leitner
2017-02-09 11:23           ` [PATCHv6 net-next 4/6] sctp: implement sender-side procedures for SSN/TSN Reset Request Parameter Marcelo Ricardo Leitner
2017-02-08 21:57       ` [PATCHv6 net-next 3/6] sctp: add support for generating stream reconf ssn/tsn reset request chun Marcelo Ricardo Leitner
2017-02-08 21:57         ` [PATCHv6 net-next 3/6] sctp: add support for generating stream reconf ssn/tsn reset request chunk Marcelo Ricardo Leitner
2017-02-09  7:56         ` [PATCHv6 net-next 3/6] sctp: add support for generating stream reconf ssn/tsn reset request chun Xin Long
2017-02-09  7:56           ` [PATCHv6 net-next 3/6] sctp: add support for generating stream reconf ssn/tsn reset request chunk Xin Long
2017-02-08 21:56     ` Marcelo Ricardo Leitner [this message]
2017-02-08 21:56       ` [PATCHv6 net-next 2/6] sctp: streams should be recovered when it fails to send request Marcelo Ricardo Leitner
2017-02-08 21:56   ` [PATCHv6 net-next 1/6] sctp: drop unnecessary __packed from some stream reconf structures Marcelo Ricardo Leitner
2017-02-08 21:56     ` Marcelo Ricardo Leitner
2017-02-09 12:30 ` [PATCHv6 net-next 0/6] sctp: add sender-side procedures for stream reconf asoc reset and add str Neil Horman
2017-02-09 12:30   ` [PATCHv6 net-next 0/6] sctp: add sender-side procedures for stream reconf asoc reset and add streams Neil Horman
2017-02-09 21:58 ` [PATCHv6 net-next 0/6] sctp: add sender-side procedures for stream reconf asoc reset and add str David Miller
2017-02-09 21:58   ` [PATCHv6 net-next 0/6] sctp: add sender-side procedures for stream reconf asoc reset and add streams David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170208215633.GI3414@localhost.localdomain \
    --to=marcelo.leitner@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-sctp@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=vyasevich@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.