aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/sctp/user.h10
-rw-r--r--net/sctp/auth.c4
-rw-r--r--net/sctp/socket.c6
3 files changed, 13 insertions, 7 deletions
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index 9462d6ae2f37..9619b9d35c9e 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -411,6 +411,7 @@ struct sctp_event_subscribe {
411 __u8 sctp_shutdown_event; 411 __u8 sctp_shutdown_event;
412 __u8 sctp_partial_delivery_event; 412 __u8 sctp_partial_delivery_event;
413 __u8 sctp_adaptation_layer_event; 413 __u8 sctp_adaptation_layer_event;
414 __u8 sctp_authentication_event;
414}; 415};
415 416
416/* 417/*
@@ -587,7 +588,7 @@ struct sctp_authchunk {
587 * endpoint requires the peer to use. 588 * endpoint requires the peer to use.
588*/ 589*/
589struct sctp_hmacalgo { 590struct sctp_hmacalgo {
590 __u16 shmac_num_idents; 591 __u32 shmac_num_idents;
591 __u16 shmac_idents[]; 592 __u16 shmac_idents[];
592}; 593};
593 594
@@ -600,7 +601,7 @@ struct sctp_hmacalgo {
600struct sctp_authkey { 601struct sctp_authkey {
601 sctp_assoc_t sca_assoc_id; 602 sctp_assoc_t sca_assoc_id;
602 __u16 sca_keynumber; 603 __u16 sca_keynumber;
603 __u16 sca_keylen; 604 __u16 sca_keylength;
604 __u8 sca_key[]; 605 __u8 sca_key[];
605}; 606};
606 607
@@ -693,8 +694,9 @@ struct sctp_status {
693 * the peer requires to be received authenticated only. 694 * the peer requires to be received authenticated only.
694 */ 695 */
695struct sctp_authchunks { 696struct sctp_authchunks {
696 sctp_assoc_t gauth_assoc_id; 697 sctp_assoc_t gauth_assoc_id;
697 uint8_t gauth_chunks[]; 698 __u32 gauth_number_of_chunks;
699 uint8_t gauth_chunks[];
698}; 700};
699 701
700/* 702/*
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/socket.c b/net/sctp/socket.c
index 848df21dc6c1..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;
@@ -5094,6 +5094,8 @@ static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len,
5094 len = num_chunks; 5094 len = num_chunks;
5095 if (put_user(len, optlen)) 5095 if (put_user(len, optlen))
5096 return -EFAULT; 5096 return -EFAULT;
5097 if (put_user(num_chunks, &p->gauth_number_of_chunks))
5098 return -EFAULT;
5097 if (copy_to_user(to, ch->chunks, len)) 5099 if (copy_to_user(to, ch->chunks, len))
5098 return -EFAULT; 5100 return -EFAULT;
5099 5101
@@ -5133,6 +5135,8 @@ static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len,
5133 len = num_chunks; 5135 len = num_chunks;
5134 if (put_user(len, optlen)) 5136 if (put_user(len, optlen))
5135 return -EFAULT; 5137 return -EFAULT;
5138 if (put_user(num_chunks, &p->gauth_number_of_chunks))
5139 return -EFAULT;
5136 if (copy_to_user(to, ch->chunks, len)) 5140 if (copy_to_user(to, ch->chunks, len))
5137 return -EFAULT; 5141 return -EFAULT;
5138 5142