2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-18 02:04:05 +08:00

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: e090abd0d8 ("sctp: factor out stream->out allocation")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Wei Yongjun 2017-10-31 13:28:16 +00:00 committed by David S. Miller
parent 85cf7a6292
commit dc82673f0c

View File

@ -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);