diff options
| author | Michal Marek <mmarek@suse.cz> | 2010-10-27 18:15:57 -0400 |
|---|---|---|
| committer | Michal Marek <mmarek@suse.cz> | 2010-10-27 18:15:57 -0400 |
| commit | b74b953b998bcc2db91b694446f3a2619ec32de6 (patch) | |
| tree | 6ce24caabd730f6ae9287ed0676ec32e6ff31e9d /net/dccp | |
| parent | abb438526201c6a79949ad45375c051b6681c253 (diff) | |
| parent | f6f94e2ab1b33f0082ac22d71f66385a60d8157f (diff) | |
Merge commit 'v2.6.36' into kbuild/misc
Update to be able to fix a recent change to scripts/basic/docproc.c
(commit eda603f).
Diffstat (limited to 'net/dccp')
| -rw-r--r-- | net/dccp/ackvec.c | 4 | ||||
| -rw-r--r-- | net/dccp/ccid.c | 13 | ||||
| -rw-r--r-- | net/dccp/ccid.h | 8 | ||||
| -rw-r--r-- | net/dccp/ccids/ccid2.c | 1 | ||||
| -rw-r--r-- | net/dccp/ccids/ccid3.c | 6 | ||||
| -rw-r--r-- | net/dccp/dccp.h | 16 | ||||
| -rw-r--r-- | net/dccp/feat.c | 1 | ||||
| -rw-r--r-- | net/dccp/input.c | 22 | ||||
| -rw-r--r-- | net/dccp/ipv4.c | 19 | ||||
| -rw-r--r-- | net/dccp/ipv6.c | 50 | ||||
| -rw-r--r-- | net/dccp/minisocks.c | 3 | ||||
| -rw-r--r-- | net/dccp/options.c | 22 | ||||
| -rw-r--r-- | net/dccp/output.c | 19 | ||||
| -rw-r--r-- | net/dccp/probe.c | 5 | ||||
| -rw-r--r-- | net/dccp/proto.c | 38 | ||||
| -rw-r--r-- | net/dccp/timer.c | 4 |
16 files changed, 117 insertions, 114 deletions
diff --git a/net/dccp/ackvec.c b/net/dccp/ackvec.c index 01e4d39fa232..92a6fcb40d7d 100644 --- a/net/dccp/ackvec.c +++ b/net/dccp/ackvec.c | |||
| @@ -82,7 +82,7 @@ int dccp_insert_option_ackvec(struct sock *sk, struct sk_buff *skb) | |||
| 82 | elapsed_time = delta / 10; | 82 | elapsed_time = delta / 10; |
| 83 | 83 | ||
| 84 | if (elapsed_time != 0 && | 84 | if (elapsed_time != 0 && |
| 85 | dccp_insert_option_elapsed_time(sk, skb, elapsed_time)) | 85 | dccp_insert_option_elapsed_time(skb, elapsed_time)) |
| 86 | return -1; | 86 | return -1; |
| 87 | 87 | ||
| 88 | avr = dccp_ackvec_record_new(); | 88 | avr = dccp_ackvec_record_new(); |
| @@ -201,7 +201,7 @@ static inline int dccp_ackvec_set_buf_head_state(struct dccp_ackvec *av, | |||
| 201 | const unsigned int packets, | 201 | const unsigned int packets, |
| 202 | const unsigned char state) | 202 | const unsigned char state) |
| 203 | { | 203 | { |
| 204 | unsigned int gap; | 204 | long gap; |
| 205 | long new_head; | 205 | long new_head; |
| 206 | 206 | ||
| 207 | if (av->av_vec_len + packets > DCCP_MAX_ACKVEC_LEN) | 207 | if (av->av_vec_len + packets > DCCP_MAX_ACKVEC_LEN) |
diff --git a/net/dccp/ccid.c b/net/dccp/ccid.c index 57dfb9c8c4f2..36479ca61e03 100644 --- a/net/dccp/ccid.c +++ b/net/dccp/ccid.c | |||
| @@ -11,6 +11,8 @@ | |||
| 11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
| 12 | */ | 12 | */ |
| 13 | 13 | ||
| 14 | #include <linux/slab.h> | ||
| 15 | |||
| 14 | #include "ccid.h" | 16 | #include "ccid.h" |
| 15 | #include "ccids/lib/tfrc.h" | 17 | #include "ccids/lib/tfrc.h" |
| 16 | 18 | ||
| @@ -63,14 +65,13 @@ int ccid_getsockopt_builtin_ccids(struct sock *sk, int len, | |||
| 63 | u8 *ccid_array, array_len; | 65 | u8 *ccid_array, array_len; |
| 64 | int err = 0; | 66 | int err = 0; |
| 65 | 67 | ||
| 66 | if (len < ARRAY_SIZE(ccids)) | ||
| 67 | return -EINVAL; | ||
| 68 | |||
| 69 | if (ccid_get_builtin_ccids(&ccid_array, &array_len)) | 68 | if (ccid_get_builtin_ccids(&ccid_array, &array_len)) |
| 70 | return -ENOBUFS; | 69 | return -ENOBUFS; |
| 71 | 70 | ||
| 72 | if (put_user(array_len, optlen) || | 71 | if (put_user(array_len, optlen)) |
| 73 | copy_to_user(optval, ccid_array, array_len)) | 72 | err = -EFAULT; |
| 73 | else if (len > 0 && copy_to_user(optval, ccid_array, | ||
| 74 | len > array_len ? array_len : len)) | ||
| 74 | err = -EFAULT; | 75 | err = -EFAULT; |
| 75 | 76 | ||
| 76 | kfree(ccid_array); | 77 | kfree(ccid_array); |
| @@ -83,7 +84,7 @@ static struct kmem_cache *ccid_kmem_cache_create(int obj_size, char *slab_name_f | |||
| 83 | va_list args; | 84 | va_list args; |
| 84 | 85 | ||
| 85 | va_start(args, fmt); | 86 | va_start(args, fmt); |
| 86 | vsnprintf(slab_name_fmt, sizeof(slab_name_fmt), fmt, args); | 87 | vsnprintf(slab_name_fmt, CCID_SLAB_NAME_LENGTH, fmt, args); |
| 87 | va_end(args); | 88 | va_end(args); |
| 88 | 89 | ||
| 89 | slab = kmem_cache_create(slab_name_fmt, sizeof(struct ccid) + obj_size, 0, | 90 | slab = kmem_cache_create(slab_name_fmt, sizeof(struct ccid) + obj_size, 0, |
diff --git a/net/dccp/ccid.h b/net/dccp/ccid.h index 269958bf7fe9..6df6f8ac9636 100644 --- a/net/dccp/ccid.h +++ b/net/dccp/ccid.h | |||
| @@ -19,7 +19,9 @@ | |||
| 19 | #include <linux/list.h> | 19 | #include <linux/list.h> |
| 20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
| 21 | 21 | ||
| 22 | #define CCID_MAX 255 | 22 | /* maximum value for a CCID (RFC 4340, 19.5) */ |
| 23 | #define CCID_MAX 255 | ||
| 24 | #define CCID_SLAB_NAME_LENGTH 32 | ||
| 23 | 25 | ||
| 24 | struct tcp_info; | 26 | struct tcp_info; |
| 25 | 27 | ||
| @@ -49,8 +51,8 @@ struct ccid_operations { | |||
| 49 | const char *ccid_name; | 51 | const char *ccid_name; |
| 50 | struct kmem_cache *ccid_hc_rx_slab, | 52 | struct kmem_cache *ccid_hc_rx_slab, |
| 51 | *ccid_hc_tx_slab; | 53 | *ccid_hc_tx_slab; |
| 52 | char ccid_hc_rx_slab_name[32]; | 54 | char ccid_hc_rx_slab_name[CCID_SLAB_NAME_LENGTH]; |
| 53 | char ccid_hc_tx_slab_name[32]; | 55 | char ccid_hc_tx_slab_name[CCID_SLAB_NAME_LENGTH]; |
| 54 | __u32 ccid_hc_rx_obj_size, | 56 | __u32 ccid_hc_rx_obj_size, |
| 55 | ccid_hc_tx_obj_size; | 57 | ccid_hc_tx_obj_size; |
| 56 | /* Interface Routines */ | 58 | /* Interface Routines */ |
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c index a47a8c918ee8..9b3ae9922be1 100644 --- a/net/dccp/ccids/ccid2.c +++ b/net/dccp/ccids/ccid2.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | /* | 23 | /* |
| 24 | * This implementation should follow RFC 4341 | 24 | * This implementation should follow RFC 4341 |
| 25 | */ | 25 | */ |
| 26 | #include <linux/slab.h> | ||
| 26 | #include "../feat.h" | 27 | #include "../feat.h" |
| 27 | #include "../ccid.h" | 28 | #include "../ccid.h" |
| 28 | #include "../dccp.h" | 29 | #include "../dccp.h" |
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index bcd7632299f5..95f752986497 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
| @@ -208,7 +208,7 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data) | |||
| 208 | goto restart_timer; | 208 | goto restart_timer; |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | ccid3_pr_debug("%s(%p, state=%s) - entry \n", dccp_role(sk), sk, | 211 | ccid3_pr_debug("%s(%p, state=%s) - entry\n", dccp_role(sk), sk, |
| 212 | ccid3_tx_state_name(hc->tx_state)); | 212 | ccid3_tx_state_name(hc->tx_state)); |
| 213 | 213 | ||
| 214 | if (hc->tx_state == TFRC_SSTATE_FBACK) | 214 | if (hc->tx_state == TFRC_SSTATE_FBACK) |
| @@ -715,9 +715,9 @@ static int ccid3_hc_rx_insert_options(struct sock *sk, struct sk_buff *skb) | |||
| 715 | x_recv = htonl(hc->rx_x_recv); | 715 | x_recv = htonl(hc->rx_x_recv); |
| 716 | pinv = htonl(hc->rx_pinv); | 716 | pinv = htonl(hc->rx_pinv); |
| 717 | 717 | ||
| 718 | if (dccp_insert_option(sk, skb, TFRC_OPT_LOSS_EVENT_RATE, | 718 | if (dccp_insert_option(skb, TFRC_OPT_LOSS_EVENT_RATE, |
| 719 | &pinv, sizeof(pinv)) || | 719 | &pinv, sizeof(pinv)) || |
| 720 | dccp_insert_option(sk, skb, TFRC_OPT_RECEIVE_RATE, | 720 | dccp_insert_option(skb, TFRC_OPT_RECEIVE_RATE, |
| 721 | &x_recv, sizeof(x_recv))) | 721 | &x_recv, sizeof(x_recv))) |
| 722 | return -1; | 722 | return -1; |
| 723 | 723 | ||
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index 5ef32c2f0d6a..3ccef1b70fee 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h | |||
| @@ -189,7 +189,7 @@ enum { | |||
| 189 | #define DCCP_MIB_MAX __DCCP_MIB_MAX | 189 | #define DCCP_MIB_MAX __DCCP_MIB_MAX |
| 190 | struct dccp_mib { | 190 | struct dccp_mib { |
| 191 | unsigned long mibs[DCCP_MIB_MAX]; | 191 | unsigned long mibs[DCCP_MIB_MAX]; |
| 192 | } __SNMP_MIB_ALIGN__; | 192 | }; |
| 193 | 193 | ||
| 194 | DECLARE_SNMP_STAT(struct dccp_mib, dccp_statistics); | 194 | DECLARE_SNMP_STAT(struct dccp_mib, dccp_statistics); |
| 195 | #define DCCP_INC_STATS(field) SNMP_INC_STATS(dccp_statistics, field) | 195 | #define DCCP_INC_STATS(field) SNMP_INC_STATS(dccp_statistics, field) |
| @@ -223,7 +223,7 @@ static inline void dccp_csum_outgoing(struct sk_buff *skb) | |||
| 223 | skb->csum = skb_checksum(skb, 0, (cov > skb->len)? skb->len : cov, 0); | 223 | skb->csum = skb_checksum(skb, 0, (cov > skb->len)? skb->len : cov, 0); |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | extern void dccp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb); | 226 | extern void dccp_v4_send_check(struct sock *sk, struct sk_buff *skb); |
| 227 | 227 | ||
| 228 | extern int dccp_retransmit_skb(struct sock *sk); | 228 | extern int dccp_retransmit_skb(struct sock *sk); |
| 229 | 229 | ||
| @@ -446,16 +446,12 @@ extern void dccp_feat_list_purge(struct list_head *fn_list); | |||
| 446 | 446 | ||
| 447 | extern int dccp_insert_options(struct sock *sk, struct sk_buff *skb); | 447 | extern int dccp_insert_options(struct sock *sk, struct sk_buff *skb); |
| 448 | extern int dccp_insert_options_rsk(struct dccp_request_sock*, struct sk_buff*); | 448 | extern int dccp_insert_options_rsk(struct dccp_request_sock*, struct sk_buff*); |
| 449 | extern int dccp_insert_option_elapsed_time(struct sock *sk, | 449 | extern int dccp_insert_option_elapsed_time(struct sk_buff *skb, u32 elapsed); |
| 450 | struct sk_buff *skb, | ||
| 451 | u32 elapsed_time); | ||
| 452 | extern u32 dccp_timestamp(void); | 450 | extern u32 dccp_timestamp(void); |
| 453 | extern void dccp_timestamping_init(void); | 451 | extern void dccp_timestamping_init(void); |
| 454 | extern int dccp_insert_option_timestamp(struct sock *sk, | 452 | extern int dccp_insert_option_timestamp(struct sk_buff *skb); |
| 455 | struct sk_buff *skb); | 453 | extern int dccp_insert_option(struct sk_buff *skb, unsigned char option, |
| 456 | extern int dccp_insert_option(struct sock *sk, struct sk_buff *skb, | 454 | const void *value, unsigned char len); |
| 457 | unsigned char option, | ||
| 458 | const void *value, unsigned char len); | ||
| 459 | 455 | ||
| 460 | #ifdef CONFIG_SYSCTL | 456 | #ifdef CONFIG_SYSCTL |
| 461 | extern int dccp_sysctl_init(void); | 457 | extern int dccp_sysctl_init(void); |
diff --git a/net/dccp/feat.c b/net/dccp/feat.c index 972b8dc918d6..df7dd26cf07e 100644 --- a/net/dccp/feat.c +++ b/net/dccp/feat.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | * 2 of the License, or (at your option) any later version. | 22 | * 2 of the License, or (at your option) any later version. |
| 23 | */ | 23 | */ |
| 24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
| 25 | #include <linux/slab.h> | ||
| 25 | #include "ccid.h" | 26 | #include "ccid.h" |
| 26 | #include "feat.h" | 27 | #include "feat.h" |
| 27 | 28 | ||
diff --git a/net/dccp/input.c b/net/dccp/input.c index 7648f316310f..10c957a88f4f 100644 --- a/net/dccp/input.c +++ b/net/dccp/input.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | #include <linux/dccp.h> | 13 | #include <linux/dccp.h> |
| 14 | #include <linux/skbuff.h> | 14 | #include <linux/skbuff.h> |
| 15 | #include <linux/slab.h> | ||
| 15 | 16 | ||
| 16 | #include <net/sock.h> | 17 | #include <net/sock.h> |
| 17 | 18 | ||
| @@ -123,9 +124,9 @@ static int dccp_rcv_closereq(struct sock *sk, struct sk_buff *skb) | |||
| 123 | return queued; | 124 | return queued; |
| 124 | } | 125 | } |
| 125 | 126 | ||
| 126 | static u8 dccp_reset_code_convert(const u8 code) | 127 | static u16 dccp_reset_code_convert(const u8 code) |
| 127 | { | 128 | { |
| 128 | const u8 error_code[] = { | 129 | const u16 error_code[] = { |
| 129 | [DCCP_RESET_CODE_CLOSED] = 0, /* normal termination */ | 130 | [DCCP_RESET_CODE_CLOSED] = 0, /* normal termination */ |
| 130 | [DCCP_RESET_CODE_UNSPECIFIED] = 0, /* nothing known */ | 131 | [DCCP_RESET_CODE_UNSPECIFIED] = 0, /* nothing known */ |
| 131 | [DCCP_RESET_CODE_ABORTED] = ECONNRESET, | 132 | [DCCP_RESET_CODE_ABORTED] = ECONNRESET, |
| @@ -147,7 +148,7 @@ static u8 dccp_reset_code_convert(const u8 code) | |||
| 147 | 148 | ||
| 148 | static void dccp_rcv_reset(struct sock *sk, struct sk_buff *skb) | 149 | static void dccp_rcv_reset(struct sock *sk, struct sk_buff *skb) |
| 149 | { | 150 | { |
| 150 | u8 err = dccp_reset_code_convert(dccp_hdr_reset(skb)->dccph_reset_code); | 151 | u16 err = dccp_reset_code_convert(dccp_hdr_reset(skb)->dccph_reset_code); |
| 151 | 152 | ||
| 152 | sk->sk_err = err; | 153 | sk->sk_err = err; |
| 153 | 154 | ||
| @@ -414,7 +415,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk, | |||
| 414 | if (!between48(DCCP_SKB_CB(skb)->dccpd_ack_seq, | 415 | if (!between48(DCCP_SKB_CB(skb)->dccpd_ack_seq, |
| 415 | dp->dccps_awl, dp->dccps_awh)) { | 416 | dp->dccps_awl, dp->dccps_awh)) { |
| 416 | dccp_pr_debug("invalid ackno: S.AWL=%llu, " | 417 | dccp_pr_debug("invalid ackno: S.AWL=%llu, " |
| 417 | "P.ackno=%llu, S.AWH=%llu \n", | 418 | "P.ackno=%llu, S.AWH=%llu\n", |
| 418 | (unsigned long long)dp->dccps_awl, | 419 | (unsigned long long)dp->dccps_awl, |
| 419 | (unsigned long long)DCCP_SKB_CB(skb)->dccpd_ack_seq, | 420 | (unsigned long long)DCCP_SKB_CB(skb)->dccpd_ack_seq, |
| 420 | (unsigned long long)dp->dccps_awh); | 421 | (unsigned long long)dp->dccps_awh); |
| @@ -429,7 +430,7 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk, | |||
| 429 | if (dccp_parse_options(sk, NULL, skb)) | 430 | if (dccp_parse_options(sk, NULL, skb)) |
| 430 | return 1; | 431 | return 1; |
| 431 | 432 | ||
| 432 | /* Obtain usec RTT sample from SYN exchange (used by CCID 3) */ | 433 | /* Obtain usec RTT sample from SYN exchange (used by TFRC). */ |
| 433 | if (likely(dp->dccps_options_received.dccpor_timestamp_echo)) | 434 | if (likely(dp->dccps_options_received.dccpor_timestamp_echo)) |
| 434 | dp->dccps_syn_rtt = dccp_sample_rtt(sk, 10 * (tstamp - | 435 | dp->dccps_syn_rtt = dccp_sample_rtt(sk, 10 * (tstamp - |
| 435 | dp->dccps_options_received.dccpor_timestamp_echo)); | 436 | dp->dccps_options_received.dccpor_timestamp_echo)); |
| @@ -534,6 +535,8 @@ static int dccp_rcv_respond_partopen_state_process(struct sock *sk, | |||
| 534 | const struct dccp_hdr *dh, | 535 | const struct dccp_hdr *dh, |
| 535 | const unsigned len) | 536 | const unsigned len) |
| 536 | { | 537 | { |
| 538 | struct dccp_sock *dp = dccp_sk(sk); | ||
| 539 | u32 sample = dp->dccps_options_received.dccpor_timestamp_echo; | ||
| 537 | int queued = 0; | 540 | int queued = 0; |
| 538 | 541 | ||
| 539 | switch (dh->dccph_type) { | 542 | switch (dh->dccph_type) { |
| @@ -558,7 +561,14 @@ static int dccp_rcv_respond_partopen_state_process(struct sock *sk, | |||
| 558 | if (sk->sk_state == DCCP_PARTOPEN) | 561 | if (sk->sk_state == DCCP_PARTOPEN) |
| 559 | inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK); | 562 | inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK); |
| 560 | 563 | ||
| 561 | dccp_sk(sk)->dccps_osr = DCCP_SKB_CB(skb)->dccpd_seq; | 564 | /* Obtain usec RTT sample from SYN exchange (used by TFRC). */ |
| 565 | if (likely(sample)) { | ||
| 566 | long delta = dccp_timestamp() - sample; | ||
| 567 | |||
| 568 | dp->dccps_syn_rtt = dccp_sample_rtt(sk, 10 * delta); | ||
| 569 | } | ||
| 570 | |||
| 571 | dp->dccps_osr = DCCP_SKB_CB(skb)->dccpd_seq; | ||
| 562 | dccp_set_state(sk, DCCP_OPEN); | 572 | dccp_set_state(sk, DCCP_OPEN); |
| 563 | 573 | ||
| 564 | if (dh->dccph_type == DCCP_PKT_DATAACK || | 574 | if (dh->dccph_type == DCCP_PKT_DATAACK || |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index dad7bc4878e0..d4a166f0f391 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | #include <linux/dccp.h> | 13 | #include <linux/dccp.h> |
| 14 | #include <linux/icmp.h> | 14 | #include <linux/icmp.h> |
| 15 | #include <linux/slab.h> | ||
| 15 | #include <linux/module.h> | 16 | #include <linux/module.h> |
| 16 | #include <linux/skbuff.h> | 17 | #include <linux/skbuff.h> |
| 17 | #include <linux/random.h> | 18 | #include <linux/random.h> |
| @@ -104,7 +105,7 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
| 104 | goto failure; | 105 | goto failure; |
| 105 | 106 | ||
| 106 | /* OK, now commit destination to socket. */ | 107 | /* OK, now commit destination to socket. */ |
| 107 | sk_setup_caps(sk, &rt->u.dst); | 108 | sk_setup_caps(sk, &rt->dst); |
| 108 | 109 | ||
| 109 | dp->dccps_iss = secure_dccp_sequence_number(inet->inet_saddr, | 110 | dp->dccps_iss = secure_dccp_sequence_number(inet->inet_saddr, |
| 110 | inet->inet_daddr, | 111 | inet->inet_daddr, |
| @@ -348,7 +349,7 @@ static inline __sum16 dccp_v4_csum_finish(struct sk_buff *skb, | |||
| 348 | return csum_tcpudp_magic(src, dst, skb->len, IPPROTO_DCCP, skb->csum); | 349 | return csum_tcpudp_magic(src, dst, skb->len, IPPROTO_DCCP, skb->csum); |
| 349 | } | 350 | } |
| 350 | 351 | ||
| 351 | void dccp_v4_send_check(struct sock *sk, int unused, struct sk_buff *skb) | 352 | void dccp_v4_send_check(struct sock *sk, struct sk_buff *skb) |
| 352 | { | 353 | { |
| 353 | const struct inet_sock *inet = inet_sk(sk); | 354 | const struct inet_sock *inet = inet_sk(sk); |
| 354 | struct dccp_hdr *dh = dccp_hdr(skb); | 355 | struct dccp_hdr *dh = dccp_hdr(skb); |
| @@ -474,7 +475,7 @@ static struct dst_entry* dccp_v4_route_skb(struct net *net, struct sock *sk, | |||
| 474 | return NULL; | 475 | return NULL; |
| 475 | } | 476 | } |
| 476 | 477 | ||
| 477 | return &rt->u.dst; | 478 | return &rt->dst; |
| 478 | } | 479 | } |
| 479 | 480 | ||
| 480 | static int dccp_v4_send_response(struct sock *sk, struct request_sock *req, | 481 | static int dccp_v4_send_response(struct sock *sk, struct request_sock *req, |
| @@ -996,16 +997,16 @@ static struct inet_protosw dccp_v4_protosw = { | |||
| 996 | .flags = INET_PROTOSW_ICSK, | 997 | .flags = INET_PROTOSW_ICSK, |
| 997 | }; | 998 | }; |
| 998 | 999 | ||
| 999 | static int dccp_v4_init_net(struct net *net) | 1000 | static int __net_init dccp_v4_init_net(struct net *net) |
| 1000 | { | 1001 | { |
| 1001 | int err; | 1002 | if (dccp_hashinfo.bhash == NULL) |
| 1003 | return -ESOCKTNOSUPPORT; | ||
| 1002 | 1004 | ||
| 1003 | err = inet_ctl_sock_create(&net->dccp.v4_ctl_sk, PF_INET, | 1005 | return inet_ctl_sock_create(&net->dccp.v4_ctl_sk, PF_INET, |
| 1004 | SOCK_DCCP, IPPROTO_DCCP, net); | 1006 | SOCK_DCCP, IPPROTO_DCCP, net); |
| 1005 | return err; | ||
| 1006 | } | 1007 | } |
| 1007 | 1008 | ||
| 1008 | static void dccp_v4_exit_net(struct net *net) | 1009 | static void __net_exit dccp_v4_exit_net(struct net *net) |
| 1009 | { | 1010 | { |
| 1010 | inet_ctl_sock_destroy(net->dccp.v4_ctl_sk); | 1011 | inet_ctl_sock_destroy(net->dccp.v4_ctl_sk); |
| 1011 | } | 1012 | } |
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index baf05cf43c28..6e3f32575df7 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
| 16 | #include <linux/random.h> | 16 | #include <linux/random.h> |
| 17 | #include <linux/slab.h> | ||
| 17 | #include <linux/xfrm.h> | 18 | #include <linux/xfrm.h> |
| 18 | 19 | ||
| 19 | #include <net/addrconf.h> | 20 | #include <net/addrconf.h> |
| @@ -59,8 +60,7 @@ static inline __sum16 dccp_v6_csum_finish(struct sk_buff *skb, | |||
| 59 | return csum_ipv6_magic(saddr, daddr, skb->len, IPPROTO_DCCP, skb->csum); | 60 | return csum_ipv6_magic(saddr, daddr, skb->len, IPPROTO_DCCP, skb->csum); |
| 60 | } | 61 | } |
| 61 | 62 | ||
| 62 | static inline void dccp_v6_send_check(struct sock *sk, int unused_value, | 63 | static inline void dccp_v6_send_check(struct sock *sk, struct sk_buff *skb) |
| 63 | struct sk_buff *skb) | ||
| 64 | { | 64 | { |
| 65 | struct ipv6_pinfo *np = inet6_sk(sk); | 65 | struct ipv6_pinfo *np = inet6_sk(sk); |
| 66 | struct dccp_hdr *dh = dccp_hdr(skb); | 66 | struct dccp_hdr *dh = dccp_hdr(skb); |
| @@ -248,7 +248,7 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req, | |||
| 248 | struct ipv6_pinfo *np = inet6_sk(sk); | 248 | struct ipv6_pinfo *np = inet6_sk(sk); |
| 249 | struct sk_buff *skb; | 249 | struct sk_buff *skb; |
| 250 | struct ipv6_txoptions *opt = NULL; | 250 | struct ipv6_txoptions *opt = NULL; |
| 251 | struct in6_addr *final_p = NULL, final; | 251 | struct in6_addr *final_p, final; |
| 252 | struct flowi fl; | 252 | struct flowi fl; |
| 253 | int err = -1; | 253 | int err = -1; |
| 254 | struct dst_entry *dst; | 254 | struct dst_entry *dst; |
| @@ -265,13 +265,7 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req, | |||
| 265 | 265 | ||
| 266 | opt = np->opt; | 266 | opt = np->opt; |
| 267 | 267 | ||
| 268 | if (opt != NULL && opt->srcrt != NULL) { | 268 | final_p = fl6_update_dst(&fl, opt, &final); |
| 269 | const struct rt0_hdr *rt0 = (struct rt0_hdr *)opt->srcrt; | ||
| 270 | |||
| 271 | ipv6_addr_copy(&final, &fl.fl6_dst); | ||
| 272 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); | ||
| 273 | final_p = &final; | ||
| 274 | } | ||
| 275 | 269 | ||
| 276 | err = ip6_dst_lookup(sk, &dst, &fl); | 270 | err = ip6_dst_lookup(sk, &dst, &fl); |
| 277 | if (err) | 271 | if (err) |
| @@ -292,7 +286,7 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req, | |||
| 292 | &ireq6->loc_addr, | 286 | &ireq6->loc_addr, |
| 293 | &ireq6->rmt_addr); | 287 | &ireq6->rmt_addr); |
| 294 | ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr); | 288 | ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr); |
| 295 | err = ip6_xmit(sk, skb, &fl, opt, 0); | 289 | err = ip6_xmit(sk, skb, &fl, opt); |
| 296 | err = net_xmit_eval(err); | 290 | err = net_xmit_eval(err); |
| 297 | } | 291 | } |
| 298 | 292 | ||
| @@ -347,7 +341,7 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) | |||
| 347 | if (!ip6_dst_lookup(ctl_sk, &dst, &fl)) { | 341 | if (!ip6_dst_lookup(ctl_sk, &dst, &fl)) { |
| 348 | if (xfrm_lookup(net, &dst, &fl, NULL, 0) >= 0) { | 342 | if (xfrm_lookup(net, &dst, &fl, NULL, 0) >= 0) { |
| 349 | skb_dst_set(skb, dst); | 343 | skb_dst_set(skb, dst); |
| 350 | ip6_xmit(ctl_sk, skb, &fl, NULL, 0); | 344 | ip6_xmit(ctl_sk, skb, &fl, NULL); |
| 351 | DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS); | 345 | DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS); |
| 352 | DCCP_INC_STATS_BH(DCCP_MIB_OUTRSTS); | 346 | DCCP_INC_STATS_BH(DCCP_MIB_OUTRSTS); |
| 353 | return; | 347 | return; |
| @@ -545,19 +539,13 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk, | |||
| 545 | goto out_overflow; | 539 | goto out_overflow; |
| 546 | 540 | ||
| 547 | if (dst == NULL) { | 541 | if (dst == NULL) { |
| 548 | struct in6_addr *final_p = NULL, final; | 542 | struct in6_addr *final_p, final; |
| 549 | struct flowi fl; | 543 | struct flowi fl; |
| 550 | 544 | ||
| 551 | memset(&fl, 0, sizeof(fl)); | 545 | memset(&fl, 0, sizeof(fl)); |
| 552 | fl.proto = IPPROTO_DCCP; | 546 | fl.proto = IPPROTO_DCCP; |
| 553 | ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr); | 547 | ipv6_addr_copy(&fl.fl6_dst, &ireq6->rmt_addr); |
| 554 | if (opt != NULL && opt->srcrt != NULL) { | 548 | final_p = fl6_update_dst(&fl, opt, &final); |
| 555 | const struct rt0_hdr *rt0 = (struct rt0_hdr *)opt->srcrt; | ||
| 556 | |||
| 557 | ipv6_addr_copy(&final, &fl.fl6_dst); | ||
| 558 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); | ||
| 559 | final_p = &final; | ||
| 560 | } | ||
| 561 | ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr); | 549 | ipv6_addr_copy(&fl.fl6_src, &ireq6->loc_addr); |
| 562 | fl.oif = sk->sk_bound_dev_if; | 550 | fl.oif = sk->sk_bound_dev_if; |
| 563 | fl.fl_ip_dport = inet_rsk(req)->rmt_port; | 551 | fl.fl_ip_dport = inet_rsk(req)->rmt_port; |
| @@ -885,7 +873,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
| 885 | struct inet_sock *inet = inet_sk(sk); | 873 | struct inet_sock *inet = inet_sk(sk); |
| 886 | struct ipv6_pinfo *np = inet6_sk(sk); | 874 | struct ipv6_pinfo *np = inet6_sk(sk); |
| 887 | struct dccp_sock *dp = dccp_sk(sk); | 875 | struct dccp_sock *dp = dccp_sk(sk); |
| 888 | struct in6_addr *saddr = NULL, *final_p = NULL, final; | 876 | struct in6_addr *saddr = NULL, *final_p, final; |
| 889 | struct flowi fl; | 877 | struct flowi fl; |
| 890 | struct dst_entry *dst; | 878 | struct dst_entry *dst; |
| 891 | int addr_type; | 879 | int addr_type; |
| @@ -988,13 +976,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
| 988 | fl.fl_ip_sport = inet->inet_sport; | 976 | fl.fl_ip_sport = inet->inet_sport; |
| 989 | security_sk_classify_flow(sk, &fl); | 977 | security_sk_classify_flow(sk, &fl); |
| 990 | 978 | ||
| 991 | if (np->opt != NULL && np->opt->srcrt != NULL) { | 979 | final_p = fl6_update_dst(&fl, np->opt, &final); |
| 992 | const struct rt0_hdr *rt0 = (struct rt0_hdr *)np->opt->srcrt; | ||
| 993 | |||
| 994 | ipv6_addr_copy(&final, &fl.fl6_dst); | ||
| 995 | ipv6_addr_copy(&fl.fl6_dst, rt0->addr); | ||
| 996 | final_p = &final; | ||
| 997 | } | ||
| 998 | 980 | ||
| 999 | err = ip6_dst_lookup(sk, &dst, &fl); | 981 | err = ip6_dst_lookup(sk, &dst, &fl); |
| 1000 | if (err) | 982 | if (err) |
| @@ -1189,16 +1171,16 @@ static struct inet_protosw dccp_v6_protosw = { | |||
| 1189 | .flags = INET_PROTOSW_ICSK, | 1171 | .flags = INET_PROTOSW_ICSK, |
| 1190 | }; | 1172 | }; |
| 1191 | 1173 | ||
| 1192 | static int dccp_v6_init_net(struct net *net) | 1174 | static int __net_init dccp_v6_init_net(struct net *net) |
| 1193 | { | 1175 | { |
| 1194 | int err; | 1176 | if (dccp_hashinfo.bhash == NULL) |
| 1177 | return -ESOCKTNOSUPPORT; | ||
| 1195 | 1178 | ||
| 1196 | err = inet_ctl_sock_create(&net->dccp.v6_ctl_sk, PF_INET6, | 1179 | return inet_ctl_sock_create(&net->dccp.v6_ctl_sk, PF_INET6, |
| 1197 | SOCK_DCCP, IPPROTO_DCCP, net); | 1180 | SOCK_DCCP, IPPROTO_DCCP, net); |
| 1198 | return err; | ||
| 1199 | } | 1181 | } |
| 1200 | 1182 | ||
| 1201 | static void dccp_v6_exit_net(struct net *net) | 1183 | static void __net_exit dccp_v6_exit_net(struct net *net) |
| 1202 | { | 1184 | { |
| 1203 | inet_ctl_sock_destroy(net->dccp.v6_ctl_sk); | 1185 | inet_ctl_sock_destroy(net->dccp.v6_ctl_sk); |
| 1204 | } | 1186 | } |
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c index af226a063141..128b089d3aef 100644 --- a/net/dccp/minisocks.c +++ b/net/dccp/minisocks.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | #include <linux/dccp.h> | 13 | #include <linux/dccp.h> |
| 14 | #include <linux/gfp.h> | ||
| 14 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
| 15 | #include <linux/skbuff.h> | 16 | #include <linux/skbuff.h> |
| 16 | #include <linux/timer.h> | 17 | #include <linux/timer.h> |
| @@ -254,7 +255,7 @@ int dccp_child_process(struct sock *parent, struct sock *child, | |||
| 254 | * in main socket hash table and lock on listening | 255 | * in main socket hash table and lock on listening |
| 255 | * socket does not protect us more. | 256 | * socket does not protect us more. |
| 256 | */ | 257 | */ |
| 257 | sk_add_backlog(child, skb); | 258 | __sk_add_backlog(child, skb); |
| 258 | } | 259 | } |
| 259 | 260 | ||
| 260 | bh_unlock_sock(child); | 261 | bh_unlock_sock(child); |
diff --git a/net/dccp/options.c b/net/dccp/options.c index 1b08cae9c65b..bfda087bd90d 100644 --- a/net/dccp/options.c +++ b/net/dccp/options.c | |||
| @@ -296,12 +296,11 @@ static inline u8 dccp_ndp_len(const u64 ndp) | |||
| 296 | { | 296 | { |
| 297 | if (likely(ndp <= 0xFF)) | 297 | if (likely(ndp <= 0xFF)) |
| 298 | return 1; | 298 | return 1; |
| 299 | return likely(ndp <= USHORT_MAX) ? 2 : (ndp <= UINT_MAX ? 4 : 6); | 299 | return likely(ndp <= USHRT_MAX) ? 2 : (ndp <= UINT_MAX ? 4 : 6); |
| 300 | } | 300 | } |
| 301 | 301 | ||
| 302 | int dccp_insert_option(struct sock *sk, struct sk_buff *skb, | 302 | int dccp_insert_option(struct sk_buff *skb, const unsigned char option, |
| 303 | const unsigned char option, | 303 | const void *value, const unsigned char len) |
| 304 | const void *value, const unsigned char len) | ||
| 305 | { | 304 | { |
| 306 | unsigned char *to; | 305 | unsigned char *to; |
| 307 | 306 | ||
| @@ -354,8 +353,7 @@ static inline int dccp_elapsed_time_len(const u32 elapsed_time) | |||
| 354 | return elapsed_time == 0 ? 0 : elapsed_time <= 0xFFFF ? 2 : 4; | 353 | return elapsed_time == 0 ? 0 : elapsed_time <= 0xFFFF ? 2 : 4; |
| 355 | } | 354 | } |
| 356 | 355 | ||
| 357 | int dccp_insert_option_elapsed_time(struct sock *sk, struct sk_buff *skb, | 356 | int dccp_insert_option_elapsed_time(struct sk_buff *skb, u32 elapsed_time) |
| 358 | u32 elapsed_time) | ||
| 359 | { | 357 | { |
| 360 | const int elapsed_time_len = dccp_elapsed_time_len(elapsed_time); | 358 | const int elapsed_time_len = dccp_elapsed_time_len(elapsed_time); |
| 361 | const int len = 2 + elapsed_time_len; | 359 | const int len = 2 + elapsed_time_len; |
| @@ -386,13 +384,13 @@ int dccp_insert_option_elapsed_time(struct sock *sk, struct sk_buff *skb, | |||
| 386 | 384 | ||
| 387 | EXPORT_SYMBOL_GPL(dccp_insert_option_elapsed_time); | 385 | EXPORT_SYMBOL_GPL(dccp_insert_option_elapsed_time); |
| 388 | 386 | ||
| 389 | int dccp_insert_option_timestamp(struct sock *sk, struct sk_buff *skb) | 387 | int dccp_insert_option_timestamp(struct sk_buff *skb) |
| 390 | { | 388 | { |
| 391 | __be32 now = htonl(dccp_timestamp()); | 389 | __be32 now = htonl(dccp_timestamp()); |
| 392 | /* yes this will overflow but that is the point as we want a | 390 | /* yes this will overflow but that is the point as we want a |
| 393 | * 10 usec 32 bit timer which mean it wraps every 11.9 hours */ | 391 | * 10 usec 32 bit timer which mean it wraps every 11.9 hours */ |
| 394 | 392 | ||
| 395 | return dccp_insert_option(sk, skb, DCCPO_TIMESTAMP, &now, sizeof(now)); | 393 | return dccp_insert_option(skb, DCCPO_TIMESTAMP, &now, sizeof(now)); |
| 396 | } | 394 | } |
| 397 | 395 | ||
| 398 | EXPORT_SYMBOL_GPL(dccp_insert_option_timestamp); | 396 | EXPORT_SYMBOL_GPL(dccp_insert_option_timestamp); |
| @@ -531,9 +529,9 @@ int dccp_insert_options(struct sock *sk, struct sk_buff *skb) | |||
| 531 | if (DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_REQUEST) { | 529 | if (DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_REQUEST) { |
| 532 | /* | 530 | /* |
| 533 | * Obtain RTT sample from Request/Response exchange. | 531 | * Obtain RTT sample from Request/Response exchange. |
| 534 | * This is currently used in CCID 3 initialisation. | 532 | * This is currently used for TFRC initialisation. |
| 535 | */ | 533 | */ |
| 536 | if (dccp_insert_option_timestamp(sk, skb)) | 534 | if (dccp_insert_option_timestamp(skb)) |
| 537 | return -1; | 535 | return -1; |
| 538 | 536 | ||
| 539 | } else if (dp->dccps_hc_rx_ackvec != NULL && | 537 | } else if (dp->dccps_hc_rx_ackvec != NULL && |
| @@ -564,6 +562,10 @@ int dccp_insert_options_rsk(struct dccp_request_sock *dreq, struct sk_buff *skb) | |||
| 564 | if (dccp_feat_insert_opts(NULL, dreq, skb)) | 562 | if (dccp_feat_insert_opts(NULL, dreq, skb)) |
| 565 | return -1; | 563 | return -1; |
| 566 | 564 | ||
| 565 | /* Obtain RTT sample from Response/Ack exchange (used by TFRC). */ | ||
| 566 | if (dccp_insert_option_timestamp(skb)) | ||
| 567 | return -1; | ||
| 568 | |||
| 567 | if (dreq->dreq_timestamp_echo != 0 && | 569 | if (dreq->dreq_timestamp_echo != 0 && |
| 568 | dccp_insert_option_timestamp_echo(NULL, dreq, skb)) | 570 | dccp_insert_option_timestamp_echo(NULL, dreq, skb)) |
| 569 | return -1; | 571 | return -1; |
diff --git a/net/dccp/output.c b/net/dccp/output.c index d6bb753bf6ad..aadbdb58758b 100644 --- a/net/dccp/output.c +++ b/net/dccp/output.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/dccp.h> | 13 | #include <linux/dccp.h> |
| 14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
| 15 | #include <linux/skbuff.h> | 15 | #include <linux/skbuff.h> |
| 16 | #include <linux/slab.h> | ||
| 16 | 17 | ||
| 17 | #include <net/inet_sock.h> | 18 | #include <net/inet_sock.h> |
| 18 | #include <net/sock.h> | 19 | #include <net/sock.h> |
| @@ -128,14 +129,14 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb) | |||
| 128 | break; | 129 | break; |
| 129 | } | 130 | } |
| 130 | 131 | ||
| 131 | icsk->icsk_af_ops->send_check(sk, 0, skb); | 132 | icsk->icsk_af_ops->send_check(sk, skb); |
| 132 | 133 | ||
| 133 | if (set_ack) | 134 | if (set_ack) |
| 134 | dccp_event_ack_sent(sk); | 135 | dccp_event_ack_sent(sk); |
| 135 | 136 | ||
| 136 | DCCP_INC_STATS(DCCP_MIB_OUTSEGS); | 137 | DCCP_INC_STATS(DCCP_MIB_OUTSEGS); |
| 137 | 138 | ||
| 138 | err = icsk->icsk_af_ops->queue_xmit(skb, 0); | 139 | err = icsk->icsk_af_ops->queue_xmit(skb); |
| 139 | return net_xmit_eval(err); | 140 | return net_xmit_eval(err); |
| 140 | } | 141 | } |
| 141 | return -ENOBUFS; | 142 | return -ENOBUFS; |
| @@ -194,15 +195,17 @@ EXPORT_SYMBOL_GPL(dccp_sync_mss); | |||
| 194 | 195 | ||
| 195 | void dccp_write_space(struct sock *sk) | 196 | void dccp_write_space(struct sock *sk) |
| 196 | { | 197 | { |
| 197 | read_lock(&sk->sk_callback_lock); | 198 | struct socket_wq *wq; |
| 198 | 199 | ||
| 199 | if (sk_has_sleeper(sk)) | 200 | rcu_read_lock(); |
| 200 | wake_up_interruptible(sk->sk_sleep); | 201 | wq = rcu_dereference(sk->sk_wq); |
| 202 | if (wq_has_sleeper(wq)) | ||
| 203 | wake_up_interruptible(&wq->wait); | ||
| 201 | /* Should agree with poll, otherwise some programs break */ | 204 | /* Should agree with poll, otherwise some programs break */ |
| 202 | if (sock_writeable(sk)) | 205 | if (sock_writeable(sk)) |
| 203 | sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); | 206 | sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); |
| 204 | 207 | ||
| 205 | read_unlock(&sk->sk_callback_lock); | 208 | rcu_read_unlock(); |
| 206 | } | 209 | } |
| 207 | 210 | ||
| 208 | /** | 211 | /** |
| @@ -224,7 +227,7 @@ static int dccp_wait_for_ccid(struct sock *sk, struct sk_buff *skb, int delay) | |||
| 224 | dccp_pr_debug("delayed send by %d msec\n", delay); | 227 | dccp_pr_debug("delayed send by %d msec\n", delay); |
| 225 | jiffdelay = msecs_to_jiffies(delay); | 228 | jiffdelay = msecs_to_jiffies(delay); |
| 226 | 229 | ||
| 227 | prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); | 230 | prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
| 228 | 231 | ||
| 229 | sk->sk_write_pending++; | 232 | sk->sk_write_pending++; |
| 230 | release_sock(sk); | 233 | release_sock(sk); |
| @@ -240,7 +243,7 @@ static int dccp_wait_for_ccid(struct sock *sk, struct sk_buff *skb, int delay) | |||
| 240 | rc = ccid_hc_tx_send_packet(dp->dccps_hc_tx_ccid, sk, skb); | 243 | rc = ccid_hc_tx_send_packet(dp->dccps_hc_tx_ccid, sk, skb); |
| 241 | } while ((delay = rc) > 0); | 244 | } while ((delay = rc) > 0); |
| 242 | out: | 245 | out: |
| 243 | finish_wait(sk->sk_sleep, &wait); | 246 | finish_wait(sk_sleep(sk), &wait); |
| 244 | return rc; | 247 | return rc; |
| 245 | 248 | ||
| 246 | do_error: | 249 | do_error: |
diff --git a/net/dccp/probe.c b/net/dccp/probe.c index bace1d8cbcfd..078e48d442fd 100644 --- a/net/dccp/probe.c +++ b/net/dccp/probe.c | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
| 31 | #include <linux/kfifo.h> | 31 | #include <linux/kfifo.h> |
| 32 | #include <linux/vmalloc.h> | 32 | #include <linux/vmalloc.h> |
| 33 | #include <linux/gfp.h> | ||
| 33 | #include <net/net_namespace.h> | 34 | #include <net/net_namespace.h> |
| 34 | 35 | ||
| 35 | #include "dccp.h" | 36 | #include "dccp.h" |
| @@ -161,8 +162,8 @@ static __init int dccpprobe_init(void) | |||
| 161 | if (!proc_net_fops_create(&init_net, procname, S_IRUSR, &dccpprobe_fops)) | 162 | if (!proc_net_fops_create(&init_net, procname, S_IRUSR, &dccpprobe_fops)) |
| 162 | goto err0; | 163 | goto err0; |
| 163 | 164 | ||
| 164 | ret = try_then_request_module((register_jprobe(&dccp_send_probe) == 0), | 165 | try_then_request_module((ret = register_jprobe(&dccp_send_probe)) == 0, |
| 165 | "dccp"); | 166 | "dccp"); |
| 166 | if (ret) | 167 | if (ret) |
| 167 | goto err1; | 168 | goto err1; |
| 168 | 169 | ||
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index 671cd1413d59..096250d1323b 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/if_arp.h> | 20 | #include <linux/if_arp.h> |
| 21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
| 22 | #include <linux/random.h> | 22 | #include <linux/random.h> |
| 23 | #include <linux/slab.h> | ||
| 23 | #include <net/checksum.h> | 24 | #include <net/checksum.h> |
| 24 | 25 | ||
| 25 | #include <net/inet_sock.h> | 26 | #include <net/inet_sock.h> |
| @@ -311,7 +312,7 @@ unsigned int dccp_poll(struct file *file, struct socket *sock, | |||
| 311 | unsigned int mask; | 312 | unsigned int mask; |
| 312 | struct sock *sk = sock->sk; | 313 | struct sock *sk = sock->sk; |
| 313 | 314 | ||
| 314 | sock_poll_wait(file, sk->sk_sleep, wait); | 315 | sock_poll_wait(file, sk_sleep(sk), wait); |
| 315 | if (sk->sk_state == DCCP_LISTEN) | 316 | if (sk->sk_state == DCCP_LISTEN) |
| 316 | return inet_csk_listen_poll(sk); | 317 | return inet_csk_listen_poll(sk); |
| 317 | 318 | ||
| @@ -472,14 +473,9 @@ static int dccp_setsockopt_ccid(struct sock *sk, int type, | |||
| 472 | if (optlen < 1 || optlen > DCCP_FEAT_MAX_SP_VALS) | 473 | if (optlen < 1 || optlen > DCCP_FEAT_MAX_SP_VALS) |
| 473 | return -EINVAL; | 474 | return -EINVAL; |
| 474 | 475 | ||
| 475 | val = kmalloc(optlen, GFP_KERNEL); | 476 | val = memdup_user(optval, optlen); |
| 476 | if (val == NULL) | 477 | if (IS_ERR(val)) |
| 477 | return -ENOMEM; | 478 | return PTR_ERR(val); |
| 478 | |||
| 479 | if (copy_from_user(val, optval, optlen)) { | ||
| 480 | kfree(val); | ||
| 481 | return -EFAULT; | ||
| 482 | } | ||
| 483 | 479 | ||
| 484 | lock_sock(sk); | 480 | lock_sock(sk); |
| 485 | if (type == DCCP_SOCKOPT_TX_CCID || type == DCCP_SOCKOPT_CCID) | 481 | if (type == DCCP_SOCKOPT_TX_CCID || type == DCCP_SOCKOPT_CCID) |
| @@ -835,6 +831,8 @@ verify_sock_status: | |||
| 835 | len = -EFAULT; | 831 | len = -EFAULT; |
| 836 | break; | 832 | break; |
| 837 | } | 833 | } |
| 834 | if (flags & MSG_TRUNC) | ||
| 835 | len = skb->len; | ||
| 838 | found_fin_ok: | 836 | found_fin_ok: |
| 839 | if (!(flags & MSG_PEEK)) | 837 | if (!(flags & MSG_PEEK)) |
| 840 | sk_eat_skb(sk, skb, 0); | 838 | sk_eat_skb(sk, skb, 0); |
| @@ -1003,12 +1001,14 @@ EXPORT_SYMBOL_GPL(dccp_shutdown); | |||
| 1003 | 1001 | ||
| 1004 | static inline int dccp_mib_init(void) | 1002 | static inline int dccp_mib_init(void) |
| 1005 | { | 1003 | { |
| 1006 | return snmp_mib_init((void**)dccp_statistics, sizeof(struct dccp_mib)); | 1004 | return snmp_mib_init((void __percpu **)dccp_statistics, |
| 1005 | sizeof(struct dccp_mib), | ||
| 1006 | __alignof__(struct dccp_mib)); | ||
| 1007 | } | 1007 | } |
| 1008 | 1008 | ||
| 1009 | static inline void dccp_mib_exit(void) | 1009 | static inline void dccp_mib_exit(void) |
| 1010 | { | 1010 | { |
| 1011 | snmp_mib_free((void**)dccp_statistics); | 1011 | snmp_mib_free((void __percpu **)dccp_statistics); |
| 1012 | } | 1012 | } |
| 1013 | 1013 | ||
| 1014 | static int thash_entries; | 1014 | static int thash_entries; |
| @@ -1033,7 +1033,7 @@ static int __init dccp_init(void) | |||
| 1033 | FIELD_SIZEOF(struct sk_buff, cb)); | 1033 | FIELD_SIZEOF(struct sk_buff, cb)); |
| 1034 | rc = percpu_counter_init(&dccp_orphan_count, 0); | 1034 | rc = percpu_counter_init(&dccp_orphan_count, 0); |
| 1035 | if (rc) | 1035 | if (rc) |
| 1036 | goto out; | 1036 | goto out_fail; |
| 1037 | rc = -ENOBUFS; | 1037 | rc = -ENOBUFS; |
| 1038 | inet_hashinfo_init(&dccp_hashinfo); | 1038 | inet_hashinfo_init(&dccp_hashinfo); |
| 1039 | dccp_hashinfo.bind_bucket_cachep = | 1039 | dccp_hashinfo.bind_bucket_cachep = |
| @@ -1122,8 +1122,9 @@ static int __init dccp_init(void) | |||
| 1122 | goto out_sysctl_exit; | 1122 | goto out_sysctl_exit; |
| 1123 | 1123 | ||
| 1124 | dccp_timestamping_init(); | 1124 | dccp_timestamping_init(); |
| 1125 | out: | 1125 | |
| 1126 | return rc; | 1126 | return 0; |
| 1127 | |||
| 1127 | out_sysctl_exit: | 1128 | out_sysctl_exit: |
| 1128 | dccp_sysctl_exit(); | 1129 | dccp_sysctl_exit(); |
| 1129 | out_ackvec_exit: | 1130 | out_ackvec_exit: |
| @@ -1132,18 +1133,19 @@ out_free_dccp_mib: | |||
| 1132 | dccp_mib_exit(); | 1133 | dccp_mib_exit(); |
| 1133 | out_free_dccp_bhash: | 1134 | out_free_dccp_bhash: |
| 1134 | free_pages((unsigned long)dccp_hashinfo.bhash, bhash_order); | 1135 | free_pages((unsigned long)dccp_hashinfo.bhash, bhash_order); |
| 1135 | dccp_hashinfo.bhash = NULL; | ||
| 1136 | out_free_dccp_locks: | 1136 | out_free_dccp_locks: |
| 1137 | inet_ehash_locks_free(&dccp_hashinfo); | 1137 | inet_ehash_locks_free(&dccp_hashinfo); |
| 1138 | out_free_dccp_ehash: | 1138 | out_free_dccp_ehash: |
| 1139 | free_pages((unsigned long)dccp_hashinfo.ehash, ehash_order); | 1139 | free_pages((unsigned long)dccp_hashinfo.ehash, ehash_order); |
| 1140 | dccp_hashinfo.ehash = NULL; | ||
| 1141 | out_free_bind_bucket_cachep: | 1140 | out_free_bind_bucket_cachep: |
| 1142 | kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep); | 1141 | kmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep); |
| 1143 | dccp_hashinfo.bind_bucket_cachep = NULL; | ||
| 1144 | out_free_percpu: | 1142 | out_free_percpu: |
| 1145 | percpu_counter_destroy(&dccp_orphan_count); | 1143 | percpu_counter_destroy(&dccp_orphan_count); |
| 1146 | goto out; | 1144 | out_fail: |
| 1145 | dccp_hashinfo.bhash = NULL; | ||
| 1146 | dccp_hashinfo.ehash = NULL; | ||
| 1147 | dccp_hashinfo.bind_bucket_cachep = NULL; | ||
| 1148 | return rc; | ||
| 1147 | } | 1149 | } |
| 1148 | 1150 | ||
| 1149 | static void __exit dccp_fini(void) | 1151 | static void __exit dccp_fini(void) |
diff --git a/net/dccp/timer.c b/net/dccp/timer.c index bbfeb5eae46a..1a9aa05d4dc4 100644 --- a/net/dccp/timer.c +++ b/net/dccp/timer.c | |||
| @@ -38,7 +38,7 @@ static int dccp_write_timeout(struct sock *sk) | |||
| 38 | 38 | ||
| 39 | if (sk->sk_state == DCCP_REQUESTING || sk->sk_state == DCCP_PARTOPEN) { | 39 | if (sk->sk_state == DCCP_REQUESTING || sk->sk_state == DCCP_PARTOPEN) { |
| 40 | if (icsk->icsk_retransmits != 0) | 40 | if (icsk->icsk_retransmits != 0) |
| 41 | dst_negative_advice(&sk->sk_dst_cache, sk); | 41 | dst_negative_advice(sk); |
| 42 | retry_until = icsk->icsk_syn_retries ? | 42 | retry_until = icsk->icsk_syn_retries ? |
| 43 | : sysctl_dccp_request_retries; | 43 | : sysctl_dccp_request_retries; |
| 44 | } else { | 44 | } else { |
| @@ -63,7 +63,7 @@ static int dccp_write_timeout(struct sock *sk) | |||
| 63 | Golden words :-). | 63 | Golden words :-). |
| 64 | */ | 64 | */ |
| 65 | 65 | ||
| 66 | dst_negative_advice(&sk->sk_dst_cache, sk); | 66 | dst_negative_advice(sk); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | retry_until = sysctl_dccp_retries2; | 69 | retry_until = sysctl_dccp_retries2; |
