diff options
author | Xin Long <lucien.xin@gmail.com> | 2017-03-30 01:00:53 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-03-30 11:08:47 -0700 |
commit | 3dbcc105d5561e18ccd0842c7baab1c835562a37 (patch) | |
tree | a4612311dc9f7acaeb1a7130c56f4e63323305f8 /net/sctp/associola.c | |
parent | bcc5364bdcfe131e6379363f089e7b4108d35b70 (diff) | |
download | linux-stable-3dbcc105d5561e18ccd0842c7baab1c835562a37.tar.gz linux-stable-3dbcc105d5561e18ccd0842c7baab1c835562a37.tar.bz2 linux-stable-3dbcc105d5561e18ccd0842c7baab1c835562a37.zip |
sctp: alloc stream info when initializing asoc
When sending a msg without asoc established, sctp will send INIT packet
first and then enqueue chunks.
Before receiving INIT_ACK, stream info is not yet alloced. But enqueuing
chunks needs to access stream info, like out stream state and out stream
cnt.
This patch is to fix it by allocing out stream info when initializing an
asoc, allocing in stream and re-allocing out stream when processing init.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/associola.c')
-rw-r--r-- | net/sctp/associola.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index 0439a1a68367..0b26df5f6188 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c @@ -246,6 +246,9 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a if (!sctp_ulpq_init(&asoc->ulpq, asoc)) goto fail_init; + if (sctp_stream_new(asoc, gfp)) + goto fail_init; + /* Assume that peer would support both address types unless we are * told otherwise. */ @@ -264,7 +267,7 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a /* AUTH related initializations */ INIT_LIST_HEAD(&asoc->endpoint_shared_keys); if (sctp_auth_asoc_copy_shkeys(ep, asoc, gfp)) - goto fail_init; + goto stream_free; asoc->active_key_id = ep->active_key_id; asoc->prsctp_enable = ep->prsctp_enable; @@ -287,6 +290,8 @@ static struct sctp_association *sctp_association_init(struct sctp_association *a return asoc; +stream_free: + sctp_stream_free(asoc->stream); fail_init: sock_put(asoc->base.sk); sctp_endpoint_put(asoc->ep); |