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

sctp: pass a kernel pointer to sctp_setsockopt_autoclose

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 a98d21a1
...@@ -2242,7 +2242,7 @@ static int sctp_setsockopt_events(struct sock *sk, __u8 *sn_type, ...@@ -2242,7 +2242,7 @@ static int sctp_setsockopt_events(struct sock *sk, __u8 *sn_type,
* integer defining the number of seconds of idle time before an * integer defining the number of seconds of idle time before an
* association is closed. * association is closed.
*/ */
static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval, static int sctp_setsockopt_autoclose(struct sock *sk, u32 *optval,
unsigned int optlen) unsigned int optlen)
{ {
struct sctp_sock *sp = sctp_sk(sk); struct sctp_sock *sp = sctp_sk(sk);
...@@ -2253,9 +2253,8 @@ static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval, ...@@ -2253,9 +2253,8 @@ static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval,
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (optlen != sizeof(int)) if (optlen != sizeof(int))
return -EINVAL; return -EINVAL;
if (copy_from_user(&sp->autoclose, optval, optlen))
return -EFAULT;
sp->autoclose = *optval;
if (sp->autoclose > net->sctp.max_autoclose) if (sp->autoclose > net->sctp.max_autoclose)
sp->autoclose = net->sctp.max_autoclose; sp->autoclose = net->sctp.max_autoclose;
...@@ -4696,7 +4695,7 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname, ...@@ -4696,7 +4695,7 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname,
break; break;
case SCTP_AUTOCLOSE: case SCTP_AUTOCLOSE:
retval = sctp_setsockopt_autoclose(sk, optval, optlen); retval = sctp_setsockopt_autoclose(sk, kopt, optlen);
break; break;
case SCTP_PEER_ADDR_PARAMS: case SCTP_PEER_ADDR_PARAMS:
......
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