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

sctp: pass a kernel pointer to sctp_setsockopt_disable_fragments

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 ce5b2f89
...@@ -2184,20 +2184,12 @@ static int sctp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, ...@@ -2184,20 +2184,12 @@ static int sctp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
* exceeds the current PMTU size, the message will NOT be sent and * exceeds the current PMTU size, the message will NOT be sent and
* instead a error will be indicated to the user. * instead a error will be indicated to the user.
*/ */
static int sctp_setsockopt_disable_fragments(struct sock *sk, static int sctp_setsockopt_disable_fragments(struct sock *sk, int *val,
char __user *optval,
unsigned int optlen) unsigned int optlen)
{ {
int val;
if (optlen < sizeof(int)) if (optlen < sizeof(int))
return -EINVAL; return -EINVAL;
sctp_sk(sk)->disable_fragments = (*val == 0) ? 0 : 1;
if (get_user(val, (int __user *)optval))
return -EFAULT;
sctp_sk(sk)->disable_fragments = (val == 0) ? 0 : 1;
return 0; return 0;
} }
...@@ -4701,7 +4693,7 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname, ...@@ -4701,7 +4693,7 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname,
break; break;
case SCTP_DISABLE_FRAGMENTS: case SCTP_DISABLE_FRAGMENTS:
retval = sctp_setsockopt_disable_fragments(sk, optval, optlen); retval = sctp_setsockopt_disable_fragments(sk, kopt, optlen);
break; break;
case SCTP_EVENTS: case SCTP_EVENTS:
......
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