aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/sctp/auth.c4
-rw-r--r--net/sctp/ipv6.c12
-rw-r--r--net/sctp/protocol.c12
-rw-r--r--net/sctp/socket.c18
-rw-r--r--net/sctp/ulpevent.c2
5 files changed, 28 insertions, 20 deletions
diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index 8bb79f281774..675a5c3e68a6 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -838,11 +838,11 @@ int sctp_auth_set_key(struct sctp_endpoint *ep,
838 } 838 }
839 839
840 /* Create a new key data based on the info passed in */ 840 /* Create a new key data based on the info passed in */
841 key = sctp_auth_create_key(auth_key->sca_keylen, GFP_KERNEL); 841 key = sctp_auth_create_key(auth_key->sca_keylength, GFP_KERNEL);
842 if (!key) 842 if (!key)
843 goto nomem; 843 goto nomem;
844 844
845 memcpy(key->data, &auth_key->sca_key[0], auth_key->sca_keylen); 845 memcpy(key->data, &auth_key->sca_key[0], auth_key->sca_keylength);
846 846
847 /* If we are replacing, remove the old keys data from the 847 /* If we are replacing, remove the old keys data from the
848 * key id. If we are adding new key id, add it to the 848 * key id. If we are adding new key id, add it to the
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 4d7ec961ae1d..87f940587d5f 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -966,7 +966,7 @@ static struct inet6_protocol sctpv6_protocol = {
966 .flags = INET6_PROTO_NOPOLICY | INET6_PROTO_FINAL, 966 .flags = INET6_PROTO_NOPOLICY | INET6_PROTO_FINAL,
967}; 967};
968 968
969static struct sctp_af sctp_ipv6_specific = { 969static struct sctp_af sctp_af_inet6 = {
970 .sa_family = AF_INET6, 970 .sa_family = AF_INET6,
971 .sctp_xmit = sctp_v6_xmit, 971 .sctp_xmit = sctp_v6_xmit,
972 .setsockopt = ipv6_setsockopt, 972 .setsockopt = ipv6_setsockopt,
@@ -998,7 +998,7 @@ static struct sctp_af sctp_ipv6_specific = {
998#endif 998#endif
999}; 999};
1000 1000
1001static struct sctp_pf sctp_pf_inet6_specific = { 1001static struct sctp_pf sctp_pf_inet6 = {
1002 .event_msgname = sctp_inet6_event_msgname, 1002 .event_msgname = sctp_inet6_event_msgname,
1003 .skb_msgname = sctp_inet6_skb_msgname, 1003 .skb_msgname = sctp_inet6_skb_msgname,
1004 .af_supported = sctp_inet6_af_supported, 1004 .af_supported = sctp_inet6_af_supported,
@@ -1008,7 +1008,7 @@ static struct sctp_pf sctp_pf_inet6_specific = {
1008 .supported_addrs = sctp_inet6_supported_addrs, 1008 .supported_addrs = sctp_inet6_supported_addrs,
1009 .create_accept_sk = sctp_v6_create_accept_sk, 1009 .create_accept_sk = sctp_v6_create_accept_sk,
1010 .addr_v4map = sctp_v6_addr_v4map, 1010 .addr_v4map = sctp_v6_addr_v4map,
1011 .af = &sctp_ipv6_specific, 1011 .af = &sctp_af_inet6,
1012}; 1012};
1013 1013
1014/* Initialize IPv6 support and register with socket layer. */ 1014/* Initialize IPv6 support and register with socket layer. */
@@ -1017,10 +1017,10 @@ int sctp_v6_init(void)
1017 int rc; 1017 int rc;
1018 1018
1019 /* Register the SCTP specific PF_INET6 functions. */ 1019 /* Register the SCTP specific PF_INET6 functions. */
1020 sctp_register_pf(&sctp_pf_inet6_specific, PF_INET6); 1020 sctp_register_pf(&sctp_pf_inet6, PF_INET6);
1021 1021
1022 /* Register the SCTP specific AF_INET6 functions. */ 1022 /* Register the SCTP specific AF_INET6 functions. */
1023 sctp_register_af(&sctp_ipv6_specific); 1023 sctp_register_af(&sctp_af_inet6);
1024 1024
1025 rc = proto_register(&sctpv6_prot, 1); 1025 rc = proto_register(&sctpv6_prot, 1);
1026 if (rc) 1026 if (rc)
@@ -1051,7 +1051,7 @@ void sctp_v6_exit(void)
1051 inet6_unregister_protosw(&sctpv6_seqpacket_protosw); 1051 inet6_unregister_protosw(&sctpv6_seqpacket_protosw);
1052 inet6_unregister_protosw(&sctpv6_stream_protosw); 1052 inet6_unregister_protosw(&sctpv6_stream_protosw);
1053 proto_unregister(&sctpv6_prot); 1053 proto_unregister(&sctpv6_prot);
1054 list_del(&sctp_ipv6_specific.list); 1054 list_del(&sctp_af_inet6.list);
1055} 1055}
1056 1056
1057/* Unregister with inet6 layer. */ 1057/* Unregister with inet6 layer. */
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 22a16571499c..688546dccd82 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -832,7 +832,7 @@ static inline int sctp_v4_xmit(struct sk_buff *skb,
832 return ip_queue_xmit(skb, ipfragok); 832 return ip_queue_xmit(skb, ipfragok);
833} 833}
834 834
835static struct sctp_af sctp_ipv4_specific; 835static struct sctp_af sctp_af_inet;
836 836
837static struct sctp_pf sctp_pf_inet = { 837static struct sctp_pf sctp_pf_inet = {
838 .event_msgname = sctp_inet_event_msgname, 838 .event_msgname = sctp_inet_event_msgname,
@@ -844,7 +844,7 @@ static struct sctp_pf sctp_pf_inet = {
844 .supported_addrs = sctp_inet_supported_addrs, 844 .supported_addrs = sctp_inet_supported_addrs,
845 .create_accept_sk = sctp_v4_create_accept_sk, 845 .create_accept_sk = sctp_v4_create_accept_sk,
846 .addr_v4map = sctp_v4_addr_v4map, 846 .addr_v4map = sctp_v4_addr_v4map,
847 .af = &sctp_ipv4_specific, 847 .af = &sctp_af_inet
848}; 848};
849 849
850/* Notifier for inetaddr addition/deletion events. */ 850/* Notifier for inetaddr addition/deletion events. */
@@ -906,7 +906,7 @@ static struct net_protocol sctp_protocol = {
906}; 906};
907 907
908/* IPv4 address related functions. */ 908/* IPv4 address related functions. */
909static struct sctp_af sctp_ipv4_specific = { 909static struct sctp_af sctp_af_inet = {
910 .sa_family = AF_INET, 910 .sa_family = AF_INET,
911 .sctp_xmit = sctp_v4_xmit, 911 .sctp_xmit = sctp_v4_xmit,
912 .setsockopt = ip_setsockopt, 912 .setsockopt = ip_setsockopt,
@@ -1192,7 +1192,7 @@ SCTP_STATIC __init int sctp_init(void)
1192 sctp_sysctl_register(); 1192 sctp_sysctl_register();
1193 1193
1194 INIT_LIST_HEAD(&sctp_address_families); 1194 INIT_LIST_HEAD(&sctp_address_families);
1195 sctp_register_af(&sctp_ipv4_specific); 1195 sctp_register_af(&sctp_af_inet);
1196 1196
1197 status = proto_register(&sctp_prot, 1); 1197 status = proto_register(&sctp_prot, 1);
1198 if (status) 1198 if (status)
@@ -1249,7 +1249,7 @@ err_v6_init:
1249 proto_unregister(&sctp_prot); 1249 proto_unregister(&sctp_prot);
1250err_proto_register: 1250err_proto_register:
1251 sctp_sysctl_unregister(); 1251 sctp_sysctl_unregister();
1252 list_del(&sctp_ipv4_specific.list); 1252 list_del(&sctp_af_inet.list);
1253 free_pages((unsigned long)sctp_port_hashtable, 1253 free_pages((unsigned long)sctp_port_hashtable,
1254 get_order(sctp_port_hashsize * 1254 get_order(sctp_port_hashsize *
1255 sizeof(struct sctp_bind_hashbucket))); 1255 sizeof(struct sctp_bind_hashbucket)));
@@ -1299,7 +1299,7 @@ SCTP_STATIC __exit void sctp_exit(void)
1299 inet_unregister_protosw(&sctp_seqpacket_protosw); 1299 inet_unregister_protosw(&sctp_seqpacket_protosw);
1300 1300
1301 sctp_sysctl_unregister(); 1301 sctp_sysctl_unregister();
1302 list_del(&sctp_ipv4_specific.list); 1302 list_del(&sctp_af_inet.list);
1303 1303
1304 free_pages((unsigned long)sctp_assoc_hashtable, 1304 free_pages((unsigned long)sctp_assoc_hashtable,
1305 get_order(sctp_assoc_hashsize * 1305 get_order(sctp_assoc_hashsize *
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 44797ad88a05..939892691a26 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1964,7 +1964,7 @@ static int sctp_setsockopt_disable_fragments(struct sock *sk,
1964static int sctp_setsockopt_events(struct sock *sk, char __user *optval, 1964static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
1965 int optlen) 1965 int optlen)
1966{ 1966{
1967 if (optlen != sizeof(struct sctp_event_subscribe)) 1967 if (optlen > sizeof(struct sctp_event_subscribe))
1968 return -EINVAL; 1968 return -EINVAL;
1969 if (copy_from_user(&sctp_sk(sk)->subscribe, optval, optlen)) 1969 if (copy_from_user(&sctp_sk(sk)->subscribe, optval, optlen))
1970 return -EFAULT; 1970 return -EFAULT;
@@ -5070,6 +5070,7 @@ static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len,
5070 struct sctp_authchunks val; 5070 struct sctp_authchunks val;
5071 struct sctp_association *asoc; 5071 struct sctp_association *asoc;
5072 struct sctp_chunks_param *ch; 5072 struct sctp_chunks_param *ch;
5073 u32 num_chunks;
5073 char __user *to; 5074 char __user *to;
5074 5075
5075 if (len <= sizeof(struct sctp_authchunks)) 5076 if (len <= sizeof(struct sctp_authchunks))
@@ -5086,12 +5087,15 @@ static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len,
5086 ch = asoc->peer.peer_chunks; 5087 ch = asoc->peer.peer_chunks;
5087 5088
5088 /* See if the user provided enough room for all the data */ 5089 /* See if the user provided enough room for all the data */
5089 if (len < ntohs(ch->param_hdr.length)) 5090 num_chunks = ntohs(ch->param_hdr.length) - sizeof(sctp_paramhdr_t);
5091 if (len < num_chunks)
5090 return -EINVAL; 5092 return -EINVAL;
5091 5093
5092 len = ntohs(ch->param_hdr.length); 5094 len = num_chunks;
5093 if (put_user(len, optlen)) 5095 if (put_user(len, optlen))
5094 return -EFAULT; 5096 return -EFAULT;
5097 if (put_user(num_chunks, &p->gauth_number_of_chunks))
5098 return -EFAULT;
5095 if (copy_to_user(to, ch->chunks, len)) 5099 if (copy_to_user(to, ch->chunks, len))
5096 return -EFAULT; 5100 return -EFAULT;
5097 5101
@@ -5105,6 +5109,7 @@ static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len,
5105 struct sctp_authchunks val; 5109 struct sctp_authchunks val;
5106 struct sctp_association *asoc; 5110 struct sctp_association *asoc;
5107 struct sctp_chunks_param *ch; 5111 struct sctp_chunks_param *ch;
5112 u32 num_chunks;
5108 char __user *to; 5113 char __user *to;
5109 5114
5110 if (len <= sizeof(struct sctp_authchunks)) 5115 if (len <= sizeof(struct sctp_authchunks))
@@ -5123,12 +5128,15 @@ static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len,
5123 else 5128 else
5124 ch = sctp_sk(sk)->ep->auth_chunk_list; 5129 ch = sctp_sk(sk)->ep->auth_chunk_list;
5125 5130
5126 if (len < ntohs(ch->param_hdr.length)) 5131 num_chunks = ntohs(ch->param_hdr.length) - sizeof(sctp_paramhdr_t);
5132 if (len < num_chunks)
5127 return -EINVAL; 5133 return -EINVAL;
5128 5134
5129 len = ntohs(ch->param_hdr.length); 5135 len = num_chunks;
5130 if (put_user(len, optlen)) 5136 if (put_user(len, optlen))
5131 return -EFAULT; 5137 return -EFAULT;
5138 if (put_user(num_chunks, &p->gauth_number_of_chunks))
5139 return -EFAULT;
5132 if (copy_to_user(to, ch->chunks, len)) 5140 if (copy_to_user(to, ch->chunks, len))
5133 return -EFAULT; 5141 return -EFAULT;
5134 5142
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
index e27b11f18b7f..b43f1f110f87 100644
--- a/net/sctp/ulpevent.c
+++ b/net/sctp/ulpevent.c
@@ -206,7 +206,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
206 * This field is the total length of the notification data, including 206 * This field is the total length of the notification data, including
207 * the notification header. 207 * the notification header.
208 */ 208 */
209 sac->sac_length = sizeof(struct sctp_assoc_change); 209 sac->sac_length = skb->len;
210 210
211 /* Socket Extensions for SCTP 211 /* Socket Extensions for SCTP
212 * 5.3.1.1 SCTP_ASSOC_CHANGE 212 * 5.3.1.1 SCTP_ASSOC_CHANGE