aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r--net/sctp/socket.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 9c6a4b5f6264..bd6f42a15a4b 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -5058,6 +5058,7 @@ static int sctp_getsockopt_active_key(struct sock *sk, int len,
5058static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len, 5058static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len,
5059 char __user *optval, int __user *optlen) 5059 char __user *optval, int __user *optlen)
5060{ 5060{
5061 struct sctp_authchunks __user *p = (void __user *)optval;
5061 struct sctp_authchunks val; 5062 struct sctp_authchunks val;
5062 struct sctp_association *asoc; 5063 struct sctp_association *asoc;
5063 struct sctp_chunks_param *ch; 5064 struct sctp_chunks_param *ch;
@@ -5066,10 +5067,10 @@ static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len,
5066 if (len <= sizeof(struct sctp_authchunks)) 5067 if (len <= sizeof(struct sctp_authchunks))
5067 return -EINVAL; 5068 return -EINVAL;
5068 5069
5069 if (copy_from_user(&val, optval, sizeof(struct sctp_authchunks))) 5070 if (copy_from_user(&val, p, sizeof(struct sctp_authchunks)))
5070 return -EFAULT; 5071 return -EFAULT;
5071 5072
5072 to = val.gauth_chunks; 5073 to = p->gauth_chunks;
5073 asoc = sctp_id2assoc(sk, val.gauth_assoc_id); 5074 asoc = sctp_id2assoc(sk, val.gauth_assoc_id);
5074 if (!asoc) 5075 if (!asoc)
5075 return -EINVAL; 5076 return -EINVAL;
@@ -5092,6 +5093,7 @@ static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len,
5092static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len, 5093static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len,
5093 char __user *optval, int __user *optlen) 5094 char __user *optval, int __user *optlen)
5094{ 5095{
5096 struct sctp_authchunks __user *p = (void __user *)optval;
5095 struct sctp_authchunks val; 5097 struct sctp_authchunks val;
5096 struct sctp_association *asoc; 5098 struct sctp_association *asoc;
5097 struct sctp_chunks_param *ch; 5099 struct sctp_chunks_param *ch;
@@ -5100,10 +5102,10 @@ static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len,
5100 if (len <= sizeof(struct sctp_authchunks)) 5102 if (len <= sizeof(struct sctp_authchunks))
5101 return -EINVAL; 5103 return -EINVAL;
5102 5104
5103 if (copy_from_user(&val, optval, sizeof(struct sctp_authchunks))) 5105 if (copy_from_user(&val, p, sizeof(struct sctp_authchunks)))
5104 return -EFAULT; 5106 return -EFAULT;
5105 5107
5106 to = val.gauth_chunks; 5108 to = p->gauth_chunks;
5107 asoc = sctp_id2assoc(sk, val.gauth_assoc_id); 5109 asoc = sctp_id2assoc(sk, val.gauth_assoc_id);
5108 if (!asoc && val.gauth_assoc_id && sctp_style(sk, UDP)) 5110 if (!asoc && val.gauth_assoc_id && sctp_style(sk, UDP))
5109 return -EINVAL; 5111 return -EINVAL;