Commit dc82673f authored by Wei Yongjun's avatar Wei Yongjun Committed by David S. Miller

sctp: fix error return code in sctp_send_add_streams()

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: e090abd0 ("sctp: factor out stream->out allocation")
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Acked-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 85cf7a62
...@@ -393,7 +393,7 @@ int sctp_send_add_streams(struct sctp_association *asoc, ...@@ -393,7 +393,7 @@ int sctp_send_add_streams(struct sctp_association *asoc,
{ {
struct sctp_stream *stream = &asoc->stream; struct sctp_stream *stream = &asoc->stream;
struct sctp_chunk *chunk = NULL; struct sctp_chunk *chunk = NULL;
int retval = -ENOMEM; int retval;
__u32 outcnt, incnt; __u32 outcnt, incnt;
__u16 out, in; __u16 out, in;
...@@ -425,8 +425,10 @@ int sctp_send_add_streams(struct sctp_association *asoc, ...@@ -425,8 +425,10 @@ int sctp_send_add_streams(struct sctp_association *asoc,
} }
chunk = sctp_make_strreset_addstrm(asoc, out, in); chunk = sctp_make_strreset_addstrm(asoc, out, in);
if (!chunk) if (!chunk) {
retval = -ENOMEM;
goto out; goto out;
}
asoc->strreset_chunk = chunk; asoc->strreset_chunk = chunk;
sctp_chunk_hold(asoc->strreset_chunk); sctp_chunk_hold(asoc->strreset_chunk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment