diff options
author | Christoph Hellwig <hch@lst.de> | 2020-07-19 09:21:43 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-07-20 03:26:41 +0200 |
commit | 0b49a65c77d8a4864e1d524dc51c6a4b8a6e1585 (patch) | |
tree | 0f81cc4d7c7f4ef85dd4c8a54d298415da02a7f4 /net/sctp/socket.c | |
parent | sctp: pass a kernel pointer to sctp_setsockopt_events (diff) | |
download | linux-0b49a65c77d8a4864e1d524dc51c6a4b8a6e1585.tar.xz linux-0b49a65c77d8a4864e1d524dc51c6a4b8a6e1585.zip |
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: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r-- | net/sctp/socket.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index bc37174bd71a..d7ed8c6ea375 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -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 * 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) { struct sctp_sock *sp = sctp_sk(sk); @@ -2253,9 +2253,8 @@ static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval, return -EOPNOTSUPP; if (optlen != sizeof(int)) return -EINVAL; - if (copy_from_user(&sp->autoclose, optval, optlen)) - return -EFAULT; + sp->autoclose = *optval; if (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, break; case SCTP_AUTOCLOSE: - retval = sctp_setsockopt_autoclose(sk, optval, optlen); + retval = sctp_setsockopt_autoclose(sk, kopt, optlen); break; case SCTP_PEER_ADDR_PARAMS: |