diff options
author | David S. Miller <davem@davemloft.net> | 2018-01-17 00:00:25 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-01-17 00:10:42 -0500 |
commit | c02b3741eb99a1ec733e6134c53ba59e43e19e97 (patch) | |
tree | ff7dd96c32dec2abe530e7101378443dabcb8962 /net/sctp/socket.c | |
parent | 7018d1b3f20fb4308ed9bc577160cb8ffb79b62a (diff) | |
parent | 8cbab92dff778e516064c13113ca15d4869ec883 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Overlapping changes all over.
The mini-qdisc bits were a little bit tricky, however.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r-- | net/sctp/socket.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 6a54ff06c9da..7ff444ecee75 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -85,7 +85,7 @@ | |||
85 | static int sctp_writeable(struct sock *sk); | 85 | static int sctp_writeable(struct sock *sk); |
86 | static void sctp_wfree(struct sk_buff *skb); | 86 | static void sctp_wfree(struct sk_buff *skb); |
87 | static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, | 87 | static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, |
88 | size_t msg_len, struct sock **orig_sk); | 88 | size_t msg_len); |
89 | static int sctp_wait_for_packet(struct sock *sk, int *err, long *timeo_p); | 89 | static int sctp_wait_for_packet(struct sock *sk, int *err, long *timeo_p); |
90 | static int sctp_wait_for_connect(struct sctp_association *, long *timeo_p); | 90 | static int sctp_wait_for_connect(struct sctp_association *, long *timeo_p); |
91 | static int sctp_wait_for_accept(struct sock *sk, long timeo); | 91 | static int sctp_wait_for_accept(struct sock *sk, long timeo); |
@@ -351,16 +351,14 @@ static struct sctp_af *sctp_sockaddr_af(struct sctp_sock *opt, | |||
351 | if (len < sizeof (struct sockaddr)) | 351 | if (len < sizeof (struct sockaddr)) |
352 | return NULL; | 352 | return NULL; |
353 | 353 | ||
354 | if (!opt->pf->af_supported(addr->sa.sa_family, opt)) | ||
355 | return NULL; | ||
356 | |||
354 | /* V4 mapped address are really of AF_INET family */ | 357 | /* V4 mapped address are really of AF_INET family */ |
355 | if (addr->sa.sa_family == AF_INET6 && | 358 | if (addr->sa.sa_family == AF_INET6 && |
356 | ipv6_addr_v4mapped(&addr->v6.sin6_addr)) { | 359 | ipv6_addr_v4mapped(&addr->v6.sin6_addr) && |
357 | if (!opt->pf->af_supported(AF_INET, opt)) | 360 | !opt->pf->af_supported(AF_INET, opt)) |
358 | return NULL; | 361 | return NULL; |
359 | } else { | ||
360 | /* Does this PF support this AF? */ | ||
361 | if (!opt->pf->af_supported(addr->sa.sa_family, opt)) | ||
362 | return NULL; | ||
363 | } | ||
364 | 362 | ||
365 | /* If we get this far, af is valid. */ | 363 | /* If we get this far, af is valid. */ |
366 | af = sctp_get_af_specific(addr->sa.sa_family); | 364 | af = sctp_get_af_specific(addr->sa.sa_family); |
@@ -1900,8 +1898,14 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len) | |||
1900 | */ | 1898 | */ |
1901 | if (sinit) { | 1899 | if (sinit) { |
1902 | if (sinit->sinit_num_ostreams) { | 1900 | if (sinit->sinit_num_ostreams) { |
1903 | asoc->c.sinit_num_ostreams = | 1901 | __u16 outcnt = sinit->sinit_num_ostreams; |
1904 | sinit->sinit_num_ostreams; | 1902 | |
1903 | asoc->c.sinit_num_ostreams = outcnt; | ||
1904 | /* outcnt has been changed, so re-init stream */ | ||
1905 | err = sctp_stream_init(&asoc->stream, outcnt, 0, | ||
1906 | GFP_KERNEL); | ||
1907 | if (err) | ||
1908 | goto out_free; | ||
1905 | } | 1909 | } |
1906 | if (sinit->sinit_max_instreams) { | 1910 | if (sinit->sinit_max_instreams) { |
1907 | asoc->c.sinit_max_instreams = | 1911 | asoc->c.sinit_max_instreams = |
@@ -1988,7 +1992,7 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len) | |||
1988 | timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); | 1992 | timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); |
1989 | if (!sctp_wspace(asoc)) { | 1993 | if (!sctp_wspace(asoc)) { |
1990 | /* sk can be changed by peel off when waiting for buf. */ | 1994 | /* sk can be changed by peel off when waiting for buf. */ |
1991 | err = sctp_wait_for_sndbuf(asoc, &timeo, msg_len, &sk); | 1995 | err = sctp_wait_for_sndbuf(asoc, &timeo, msg_len); |
1992 | if (err) { | 1996 | if (err) { |
1993 | if (err == -ESRCH) { | 1997 | if (err == -ESRCH) { |
1994 | /* asoc is already dead. */ | 1998 | /* asoc is already dead. */ |
@@ -8121,12 +8125,12 @@ void sctp_sock_rfree(struct sk_buff *skb) | |||
8121 | 8125 | ||
8122 | /* Helper function to wait for space in the sndbuf. */ | 8126 | /* Helper function to wait for space in the sndbuf. */ |
8123 | static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, | 8127 | static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, |
8124 | size_t msg_len, struct sock **orig_sk) | 8128 | size_t msg_len) |
8125 | { | 8129 | { |
8126 | struct sock *sk = asoc->base.sk; | 8130 | struct sock *sk = asoc->base.sk; |
8127 | int err = 0; | ||
8128 | long current_timeo = *timeo_p; | 8131 | long current_timeo = *timeo_p; |
8129 | DEFINE_WAIT(wait); | 8132 | DEFINE_WAIT(wait); |
8133 | int err = 0; | ||
8130 | 8134 | ||
8131 | pr_debug("%s: asoc:%p, timeo:%ld, msg_len:%zu\n", __func__, asoc, | 8135 | pr_debug("%s: asoc:%p, timeo:%ld, msg_len:%zu\n", __func__, asoc, |
8132 | *timeo_p, msg_len); | 8136 | *timeo_p, msg_len); |
@@ -8155,17 +8159,13 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, | |||
8155 | release_sock(sk); | 8159 | release_sock(sk); |
8156 | current_timeo = schedule_timeout(current_timeo); | 8160 | current_timeo = schedule_timeout(current_timeo); |
8157 | lock_sock(sk); | 8161 | lock_sock(sk); |
8158 | if (sk != asoc->base.sk) { | 8162 | if (sk != asoc->base.sk) |
8159 | release_sock(sk); | 8163 | goto do_error; |
8160 | sk = asoc->base.sk; | ||
8161 | lock_sock(sk); | ||
8162 | } | ||
8163 | 8164 | ||
8164 | *timeo_p = current_timeo; | 8165 | *timeo_p = current_timeo; |
8165 | } | 8166 | } |
8166 | 8167 | ||
8167 | out: | 8168 | out: |
8168 | *orig_sk = sk; | ||
8169 | finish_wait(&asoc->wait, &wait); | 8169 | finish_wait(&asoc->wait, &wait); |
8170 | 8170 | ||
8171 | /* Release the association's refcnt. */ | 8171 | /* Release the association's refcnt. */ |