Commit a1ab3582 authored by Ivan Skytte Jorgensen's avatar Ivan Skytte Jorgensen Committed by Sridhar Samudrala

[SCTP] Fix SCTP_SETADAPTION sockopt to use the correct structure.

Signed-off-by: default avatarIvan Skytte Jorgensen <isj-sctp@i1.dk>
Signed-off-by: default avatarSridhar Samudrala <sri@us.ibm.com>
parent eaa5c54d
...@@ -2384,14 +2384,14 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva ...@@ -2384,14 +2384,14 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva
static int sctp_setsockopt_adaption_layer(struct sock *sk, char __user *optval, static int sctp_setsockopt_adaption_layer(struct sock *sk, char __user *optval,
int optlen) int optlen)
{ {
__u32 val; struct sctp_setadaption adaption;
if (optlen < sizeof(__u32)) if (optlen != sizeof(struct sctp_setadaption))
return -EINVAL; return -EINVAL;
if (copy_from_user(&val, optval, sizeof(__u32))) if (copy_from_user(&adaption, optval, optlen))
return -EFAULT; return -EFAULT;
sctp_sk(sk)->adaption_ind = val; sctp_sk(sk)->adaption_ind = adaption.ssb_adaption_ind;
return 0; return 0;
} }
...@@ -3672,17 +3672,15 @@ static int sctp_getsockopt_primary_addr(struct sock *sk, int len, ...@@ -3672,17 +3672,15 @@ static int sctp_getsockopt_primary_addr(struct sock *sk, int len,
static int sctp_getsockopt_adaption_layer(struct sock *sk, int len, static int sctp_getsockopt_adaption_layer(struct sock *sk, int len,
char __user *optval, int __user *optlen) char __user *optval, int __user *optlen)
{ {
__u32 val; struct sctp_setadaption adaption;
if (len < sizeof(__u32)) if (len != sizeof(struct sctp_setadaption))
return -EINVAL; return -EINVAL;
len = sizeof(__u32); adaption.ssb_adaption_ind = sctp_sk(sk)->adaption_ind;
val = sctp_sk(sk)->adaption_ind; if (copy_to_user(optval, &adaption, len))
if (put_user(len, optlen))
return -EFAULT;
if (copy_to_user(optval, &val, len))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment