diff options
Diffstat (limited to 'net/dccp/proto.c')
| -rw-r--r-- | net/dccp/proto.c | 38 |
1 files changed, 20 insertions, 18 deletions
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) |
