aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/net/sctp
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-07-19 09:21:55 +0200
committerDavid S. Miller <davem@davemloft.net>2020-07-19 18:26:42 -0700
commitffc08f086a563cdd18f43edf574724f65e4bf5e3 (patch)
tree15ff8fd2e5bd69a147e0f71dfc3a7fa275e180eb /net/sctp
parentsctp: pass a kernel pointer to sctp_setsockopt_associnfo (diff)
downloadwireguard-linux-ffc08f086a563cdd18f43edf574724f65e4bf5e3.tar.xz
wireguard-linux-ffc08f086a563cdd18f43edf574724f65e4bf5e3.zip
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: Christoph Hellwig <hch@lst.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp')
-rw-r--r--net/sctp/socket.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 2a655c65e294..5007af318e13 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -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 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);
if (optlen < sizeof(int))
return -EINVAL;
- if (get_user(val, (int __user *)optval))
- return -EFAULT;
- if (val)
+ if (*val)
sp->v4mapped = 1;
else
sp->v4mapped = 0;
@@ -4696,7 +4694,7 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname,
retval = sctp_setsockopt_associnfo(sk, kopt, optlen);
break;
case SCTP_I_WANT_MAPPED_V4_ADDR:
- retval = sctp_setsockopt_mappedv4(sk, optval, optlen);
+ retval = sctp_setsockopt_mappedv4(sk, kopt, optlen);
break;
case SCTP_MAXSEG:
retval = sctp_setsockopt_maxseg(sk, optval, optlen);