|
@@ -1214,9 +1214,12 @@ static int __sctp_connect(struct sock *sk,
|
|
|
|
|
|
timeo = sock_sndtimeo(sk, f_flags & O_NONBLOCK);
|
|
timeo = sock_sndtimeo(sk, f_flags & O_NONBLOCK);
|
|
|
|
|
|
- err = sctp_wait_for_connect(asoc, &timeo);
|
|
|
|
- if ((err == 0 || err == -EINPROGRESS) && assoc_id)
|
|
|
|
|
|
+ if (assoc_id)
|
|
*assoc_id = asoc->assoc_id;
|
|
*assoc_id = asoc->assoc_id;
|
|
|
|
+ err = sctp_wait_for_connect(asoc, &timeo);
|
|
|
|
+ /* Note: the asoc may be freed after the return of
|
|
|
|
+ * sctp_wait_for_connect.
|
|
|
|
+ */
|
|
|
|
|
|
/* Don't free association on exit. */
|
|
/* Don't free association on exit. */
|
|
asoc = NULL;
|
|
asoc = NULL;
|