Commit 411223c0 authored by Al Viro's avatar Al Viro Committed by Linus Torvalds
Browse files

fix breakage in sctp getsockopt



copy_to_user() into on-stack array
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 47063d6b
...@@ -5058,6 +5058,7 @@ static int sctp_getsockopt_active_key(struct sock *sk, int len, ...@@ -5058,6 +5058,7 @@ static int sctp_getsockopt_active_key(struct sock *sk, int len,
static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len, static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len,
char __user *optval, int __user *optlen) char __user *optval, int __user *optlen)
{ {
struct sctp_authchunks __user *p = (void __user *)optval;
struct sctp_authchunks val; struct sctp_authchunks val;
struct sctp_association *asoc; struct sctp_association *asoc;
struct sctp_chunks_param *ch; struct sctp_chunks_param *ch;
...@@ -5066,10 +5067,10 @@ static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len, ...@@ -5066,10 +5067,10 @@ static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len,
if (len <= sizeof(struct sctp_authchunks)) if (len <= sizeof(struct sctp_authchunks))
return -EINVAL; return -EINVAL;
if (copy_from_user(&val, optval, sizeof(struct sctp_authchunks))) if (copy_from_user(&val, p, sizeof(struct sctp_authchunks)))
return -EFAULT; return -EFAULT;
to = val.gauth_chunks; to = p->gauth_chunks;
asoc = sctp_id2assoc(sk, val.gauth_assoc_id); asoc = sctp_id2assoc(sk, val.gauth_assoc_id);
if (!asoc) if (!asoc)
return -EINVAL; return -EINVAL;
...@@ -5092,6 +5093,7 @@ static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len, ...@@ -5092,6 +5093,7 @@ static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len,
static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len, static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len,
char __user *optval, int __user *optlen) char __user *optval, int __user *optlen)
{ {
struct sctp_authchunks __user *p = (void __user *)optval;
struct sctp_authchunks val; struct sctp_authchunks val;
struct sctp_association *asoc; struct sctp_association *asoc;
struct sctp_chunks_param *ch; struct sctp_chunks_param *ch;
...@@ -5100,10 +5102,10 @@ static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len, ...@@ -5100,10 +5102,10 @@ static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len,
if (len <= sizeof(struct sctp_authchunks)) if (len <= sizeof(struct sctp_authchunks))
return -EINVAL; return -EINVAL;
if (copy_from_user(&val, optval, sizeof(struct sctp_authchunks))) if (copy_from_user(&val, p, sizeof(struct sctp_authchunks)))
return -EFAULT; return -EFAULT;
to = val.gauth_chunks; to = p->gauth_chunks;
asoc = sctp_id2assoc(sk, val.gauth_assoc_id); asoc = sctp_id2assoc(sk, val.gauth_assoc_id);
if (!asoc && val.gauth_assoc_id && sctp_style(sk, UDP)) if (!asoc && val.gauth_assoc_id && sctp_style(sk, UDP))
return -EINVAL; return -EINVAL;
......
Supports Markdown
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