提交 dc82673f 编写于 作者: W Wei Yongjun 提交者: 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: NWei Yongjun <weiyongjun1@huawei.com>
Acked-by: NMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Acked-by: NNeil Horman <nhorman@tuxdriver.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册