Commit ffc08f08 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David S. Miller

sctp: pass a kernel pointer to sctp_setsockopt_mappedv4

Use the kernel pointer that sctp_setsockopt has available instead of
directly handling the user pointer.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5b864c8d
No related merge requests found
...@@ -3173,16 +3173,14 @@ static int sctp_setsockopt_associnfo(struct sock *sk, ...@@ -3173,16 +3173,14 @@ static int sctp_setsockopt_associnfo(struct sock *sk,
* addresses and a user will receive both PF_INET6 and PF_INET type * addresses and a user will receive both PF_INET6 and PF_INET type
* addresses on the socket. * addresses on the socket.
*/ */
static int sctp_setsockopt_mappedv4(struct sock *sk, char __user *optval, unsigned int optlen) static int sctp_setsockopt_mappedv4(struct sock *sk, int *val,
unsigned int optlen)
{ {
int val;
struct sctp_sock *sp = sctp_sk(sk); struct sctp_sock *sp = sctp_sk(sk);
if (optlen < sizeof(int)) if (optlen < sizeof(int))
return -EINVAL; return -EINVAL;
if (get_user(val, (int __user *)optval)) if (*val)
return -EFAULT;
if (val)
sp->v4mapped = 1; sp->v4mapped = 1;
else else
sp->v4mapped = 0; sp->v4mapped = 0;
...@@ -4696,7 +4694,7 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname, ...@@ -4696,7 +4694,7 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname,
retval = sctp_setsockopt_associnfo(sk, kopt, optlen); retval = sctp_setsockopt_associnfo(sk, kopt, optlen);
break; break;
case SCTP_I_WANT_MAPPED_V4_ADDR: case SCTP_I_WANT_MAPPED_V4_ADDR:
retval = sctp_setsockopt_mappedv4(sk, optval, optlen); retval = sctp_setsockopt_mappedv4(sk, kopt, optlen);
break; break;
case SCTP_MAXSEG: case SCTP_MAXSEG:
retval = sctp_setsockopt_maxseg(sk, optval, optlen); retval = sctp_setsockopt_maxseg(sk, optval, optlen);
......
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