aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/sctp/socket.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 170045b6ee98..c66c161908c0 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2384,14 +2384,14 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva
2384static int sctp_setsockopt_adaption_layer(struct sock *sk, char __user *optval, 2384static int sctp_setsockopt_adaption_layer(struct sock *sk, char __user *optval,
2385 int optlen) 2385 int optlen)
2386{ 2386{
2387 __u32 val; 2387 struct sctp_setadaption adaption;
2388 2388
2389 if (optlen < sizeof(__u32)) 2389 if (optlen != sizeof(struct sctp_setadaption))
2390 return -EINVAL; 2390 return -EINVAL;
2391 if (copy_from_user(&val, optval, sizeof(__u32))) 2391 if (copy_from_user(&adaption, optval, optlen))
2392 return -EFAULT; 2392 return -EFAULT;
2393 2393
2394 sctp_sk(sk)->adaption_ind = val; 2394 sctp_sk(sk)->adaption_ind = adaption.ssb_adaption_ind;
2395 2395
2396 return 0; 2396 return 0;
2397} 2397}
@@ -3672,17 +3672,15 @@ static int sctp_getsockopt_primary_addr(struct sock *sk, int len,
3672static int sctp_getsockopt_adaption_layer(struct sock *sk, int len, 3672static int sctp_getsockopt_adaption_layer(struct sock *sk, int len,
3673 char __user *optval, int __user *optlen) 3673 char __user *optval, int __user *optlen)
3674{ 3674{
3675 __u32 val; 3675 struct sctp_setadaption adaption;
3676 3676
3677 if (len < sizeof(__u32)) 3677 if (len != sizeof(struct sctp_setadaption))
3678 return -EINVAL; 3678 return -EINVAL;
3679 3679
3680 len = sizeof(__u32); 3680 adaption.ssb_adaption_ind = sctp_sk(sk)->adaption_ind;
3681 val = sctp_sk(sk)->adaption_ind; 3681 if (copy_to_user(optval, &adaption, len))
3682 if (put_user(len, optlen))
3683 return -EFAULT;
3684 if (copy_to_user(optval, &val, len))
3685 return -EFAULT; 3682 return -EFAULT;
3683
3686 return 0; 3684 return 0;
3687} 3685}
3688 3686