aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/sctp/socket.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 71b75f9d9c1b..faa48ff5cf4b 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1214,9 +1214,12 @@ static int __sctp_connect(struct sock *sk,
1214 1214
1215 timeo = sock_sndtimeo(sk, f_flags & O_NONBLOCK); 1215 timeo = sock_sndtimeo(sk, f_flags & O_NONBLOCK);
1216 1216
1217 err = sctp_wait_for_connect(asoc, &timeo); 1217 if (assoc_id)
1218 if ((err == 0 || err == -EINPROGRESS) && assoc_id)
1219 *assoc_id = asoc->assoc_id; 1218 *assoc_id = asoc->assoc_id;
1219 err = sctp_wait_for_connect(asoc, &timeo);
1220 /* Note: the asoc may be freed after the return of
1221 * sctp_wait_for_connect.
1222 */
1220 1223
1221 /* Don't free association on exit. */ 1224 /* Don't free association on exit. */
1222 asoc = NULL; 1225 asoc = NULL;