diff options
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r-- | net/sctp/socket.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 9fbb6feb8c27..f23ad913dc7a 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; |
@@ -4282,19 +4285,18 @@ static void sctp_shutdown(struct sock *sk, int how) | |||
4282 | { | 4285 | { |
4283 | struct net *net = sock_net(sk); | 4286 | struct net *net = sock_net(sk); |
4284 | struct sctp_endpoint *ep; | 4287 | struct sctp_endpoint *ep; |
4285 | struct sctp_association *asoc; | ||
4286 | 4288 | ||
4287 | if (!sctp_style(sk, TCP)) | 4289 | if (!sctp_style(sk, TCP)) |
4288 | return; | 4290 | return; |
4289 | 4291 | ||
4290 | if (how & SEND_SHUTDOWN) { | 4292 | ep = sctp_sk(sk)->ep; |
4293 | if (how & SEND_SHUTDOWN && !list_empty(&ep->asocs)) { | ||
4294 | struct sctp_association *asoc; | ||
4295 | |||
4291 | sk->sk_state = SCTP_SS_CLOSING; | 4296 | sk->sk_state = SCTP_SS_CLOSING; |
4292 | ep = sctp_sk(sk)->ep; | 4297 | asoc = list_entry(ep->asocs.next, |
4293 | if (!list_empty(&ep->asocs)) { | 4298 | struct sctp_association, asocs); |
4294 | asoc = list_entry(ep->asocs.next, | 4299 | sctp_primitive_SHUTDOWN(net, asoc, NULL); |
4295 | struct sctp_association, asocs); | ||
4296 | sctp_primitive_SHUTDOWN(net, asoc, NULL); | ||
4297 | } | ||
4298 | } | 4300 | } |
4299 | } | 4301 | } |
4300 | 4302 | ||
@@ -4480,12 +4482,9 @@ int sctp_transport_lookup_process(int (*cb)(struct sctp_transport *, void *), | |||
4480 | if (!transport || !sctp_transport_hold(transport)) | 4482 | if (!transport || !sctp_transport_hold(transport)) |
4481 | goto out; | 4483 | goto out; |
4482 | 4484 | ||
4483 | sctp_association_hold(transport->asoc); | ||
4484 | sctp_transport_put(transport); | ||
4485 | |||
4486 | rcu_read_unlock(); | 4485 | rcu_read_unlock(); |
4487 | err = cb(transport, p); | 4486 | err = cb(transport, p); |
4488 | sctp_association_put(transport->asoc); | 4487 | sctp_transport_put(transport); |
4489 | 4488 | ||
4490 | out: | 4489 | out: |
4491 | return err; | 4490 | return err; |