netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] sctp: fix error return code in sctp_send_add_streams()
@ 2017-10-31 13:28 Wei Yongjun
  2017-10-31 13:33 ` Marcelo Ricardo Leitner
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Wei Yongjun @ 2017-10-31 13:28 UTC (permalink / raw)
  To: Vlad Yasevich, Neil Horman, Marcelo Ricardo Leitner
  Cc: Wei Yongjun, linux-sctp, netdev

Fix to returnerror code -ENOMEM from the sctp_make_strreset_addstrm()
error handling case instead of 0. 'retval' can be overwritten to 0 after
call sctp_stream_alloc_out().

Fixes: e090abd0d81c ("sctp: factor out stream->out allocation")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 net/sctp/stream.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/sctp/stream.c b/net/sctp/stream.c
index 03764fc..b8c8cab 100644
--- a/net/sctp/stream.c
+++ b/net/sctp/stream.c
@@ -393,7 +393,7 @@ int sctp_send_add_streams(struct sctp_association *asoc,
 {
 	struct sctp_stream *stream = &asoc->stream;
 	struct sctp_chunk *chunk = NULL;
-	int retval = -ENOMEM;
+	int retval;
 	__u32 outcnt, incnt;
 	__u16 out, in;
 
@@ -425,8 +425,10 @@ int sctp_send_add_streams(struct sctp_association *asoc,
 	}
 
 	chunk = sctp_make_strreset_addstrm(asoc, out, in);
-	if (!chunk)
+	if (!chunk) {
+		retval = -ENOMEM;
 		goto out;
+	}
 
 	asoc->strreset_chunk = chunk;
 	sctp_chunk_hold(asoc->strreset_chunk);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] sctp: fix error return code in sctp_send_add_streams()
  2017-10-31 13:28 [PATCH net-next] sctp: fix error return code in sctp_send_add_streams() Wei Yongjun
@ 2017-10-31 13:33 ` Marcelo Ricardo Leitner
  2017-10-31 17:06 ` Neil Horman
  2017-11-01 12:26 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Marcelo Ricardo Leitner @ 2017-10-31 13:33 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: Vlad Yasevich, Neil Horman, linux-sctp, netdev

On Tue, Oct 31, 2017 at 01:28:16PM +0000, Wei Yongjun wrote:
> Fix to returnerror code -ENOMEM from the sctp_make_strreset_addstrm()
> error handling case instead of 0. 'retval' can be overwritten to 0 after
> call sctp_stream_alloc_out().
> 
> Fixes: e090abd0d81c ("sctp: factor out stream->out allocation")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

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

> ---
>  net/sctp/stream.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/net/sctp/stream.c b/net/sctp/stream.c
> index 03764fc..b8c8cab 100644
> --- a/net/sctp/stream.c
> +++ b/net/sctp/stream.c
> @@ -393,7 +393,7 @@ int sctp_send_add_streams(struct sctp_association *asoc,
>  {
>  	struct sctp_stream *stream = &asoc->stream;
>  	struct sctp_chunk *chunk = NULL;
> -	int retval = -ENOMEM;
> +	int retval;
>  	__u32 outcnt, incnt;
>  	__u16 out, in;
>  
> @@ -425,8 +425,10 @@ int sctp_send_add_streams(struct sctp_association *asoc,
>  	}
>  
>  	chunk = sctp_make_strreset_addstrm(asoc, out, in);
> -	if (!chunk)
> +	if (!chunk) {
> +		retval = -ENOMEM;
>  		goto out;
> +	}
>  
>  	asoc->strreset_chunk = chunk;
>  	sctp_chunk_hold(asoc->strreset_chunk);
> 
> --
> 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
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] sctp: fix error return code in sctp_send_add_streams()
  2017-10-31 13:28 [PATCH net-next] sctp: fix error return code in sctp_send_add_streams() Wei Yongjun
  2017-10-31 13:33 ` Marcelo Ricardo Leitner
@ 2017-10-31 17:06 ` Neil Horman
  2017-11-01 12:26 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Neil Horman @ 2017-10-31 17:06 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: Vlad Yasevich, Marcelo Ricardo Leitner, linux-sctp, netdev

On Tue, Oct 31, 2017 at 01:28:16PM +0000, Wei Yongjun wrote:
> Fix to returnerror code -ENOMEM from the sctp_make_strreset_addstrm()
> error handling case instead of 0. 'retval' can be overwritten to 0 after
> call sctp_stream_alloc_out().
> 
> Fixes: e090abd0d81c ("sctp: factor out stream->out allocation")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  net/sctp/stream.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/net/sctp/stream.c b/net/sctp/stream.c
> index 03764fc..b8c8cab 100644
> --- a/net/sctp/stream.c
> +++ b/net/sctp/stream.c
> @@ -393,7 +393,7 @@ int sctp_send_add_streams(struct sctp_association *asoc,
>  {
>  	struct sctp_stream *stream = &asoc->stream;
>  	struct sctp_chunk *chunk = NULL;
> -	int retval = -ENOMEM;
> +	int retval;
>  	__u32 outcnt, incnt;
>  	__u16 out, in;
>  
> @@ -425,8 +425,10 @@ int sctp_send_add_streams(struct sctp_association *asoc,
>  	}
>  
>  	chunk = sctp_make_strreset_addstrm(asoc, out, in);
> -	if (!chunk)
> +	if (!chunk) {
> +		retval = -ENOMEM;
>  		goto out;
> +	}
>  
>  	asoc->strreset_chunk = chunk;
>  	sctp_chunk_hold(asoc->strreset_chunk);
> 
> --
> 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
> 
Acked-by: Neil Horman <nhorman@tuxdriver.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] sctp: fix error return code in sctp_send_add_streams()
  2017-10-31 13:28 [PATCH net-next] sctp: fix error return code in sctp_send_add_streams() Wei Yongjun
  2017-10-31 13:33 ` Marcelo Ricardo Leitner
  2017-10-31 17:06 ` Neil Horman
@ 2017-11-01 12:26 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-11-01 12:26 UTC (permalink / raw)
  To: weiyongjun1; +Cc: vyasevich, nhorman, marcelo.leitner, linux-sctp, netdev

From: Wei Yongjun <weiyongjun1@huawei.com>
Date: Tue, 31 Oct 2017 13:28:16 +0000

> Fix to returnerror code -ENOMEM from the sctp_make_strreset_addstrm()
> error handling case instead of 0. 'retval' can be overwritten to 0 after
> call sctp_stream_alloc_out().
> 
> Fixes: e090abd0d81c ("sctp: factor out stream->out allocation")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-01 12:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-31 13:28 [PATCH net-next] sctp: fix error return code in sctp_send_add_streams() Wei Yongjun
2017-10-31 13:33 ` Marcelo Ricardo Leitner
2017-10-31 17:06 ` Neil Horman
2017-11-01 12:26 ` 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).