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

sctp: pass a kernel pointer to sctp_setsockopt_fragment_interleave

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 722eca9e
...@@ -3422,18 +3422,13 @@ static int sctp_setsockopt_context(struct sock *sk, ...@@ -3422,18 +3422,13 @@ static int sctp_setsockopt_context(struct sock *sk,
* application using the one to many model may become confused and act * application using the one to many model may become confused and act
* incorrectly. * incorrectly.
*/ */
static int sctp_setsockopt_fragment_interleave(struct sock *sk, static int sctp_setsockopt_fragment_interleave(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;
if (get_user(val, (int __user *)optval))
return -EFAULT;
sctp_sk(sk)->frag_interleave = !!val; sctp_sk(sk)->frag_interleave = !!*val;
if (!sctp_sk(sk)->frag_interleave) if (!sctp_sk(sk)->frag_interleave)
sctp_sk(sk)->ep->intl_enable = 0; sctp_sk(sk)->ep->intl_enable = 0;
...@@ -4701,7 +4696,7 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname, ...@@ -4701,7 +4696,7 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname,
retval = sctp_setsockopt_context(sk, kopt, optlen); retval = sctp_setsockopt_context(sk, kopt, optlen);
break; break;
case SCTP_FRAGMENT_INTERLEAVE: case SCTP_FRAGMENT_INTERLEAVE:
retval = sctp_setsockopt_fragment_interleave(sk, optval, optlen); retval = sctp_setsockopt_fragment_interleave(sk, kopt, optlen);
break; break;
case SCTP_MAX_BURST: case SCTP_MAX_BURST:
retval = sctp_setsockopt_maxburst(sk, optval, optlen); retval = sctp_setsockopt_maxburst(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