summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-07-23 09:08:48 +0300
committerDavid S. Miller <davem@davemloft.net>2020-07-25 01:41:53 +0300
commit5790642b4748acbb5560f7a6fcb19f572297cf63 (patch)
tree32ece112233de5cf9171bbcbe0fbedc3573475e7 /net
parentb1ea9ff6aff2deae84eccaf0a07cd14912669680 (diff)
downloadlinux-5790642b4748acbb5560f7a6fcb19f572297cf63.tar.xz
net: switch sock_setbindtodevice to sockptr_t
Pass a sockptr_t to prepare for set_fs-less handling of the kernel pointer from bpf-cgroup. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/sock.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 71fc7e4ddd06..5b55bc9397f2 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -609,8 +609,7 @@ int sock_bindtoindex(struct sock *sk, int ifindex, bool lock_sk)
}
EXPORT_SYMBOL(sock_bindtoindex);
-static int sock_setbindtodevice(struct sock *sk, char __user *optval,
- int optlen)
+static int sock_setbindtodevice(struct sock *sk, sockptr_t optval, int optlen)
{
int ret = -ENOPROTOOPT;
#ifdef CONFIG_NETDEVICES
@@ -632,7 +631,7 @@ static int sock_setbindtodevice(struct sock *sk, char __user *optval,
memset(devname, 0, sizeof(devname));
ret = -EFAULT;
- if (copy_from_user(devname, optval, optlen))
+ if (copy_from_sockptr(devname, optval, optlen))
goto out;
index = 0;
@@ -840,7 +839,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
*/
if (optname == SO_BINDTODEVICE)
- return sock_setbindtodevice(sk, optval, optlen);
+ return sock_setbindtodevice(sk, USER_SOCKPTR(optval), optlen);
if (optlen < sizeof(int))
return -EINVAL;