aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/net/ipv4/bpfilter
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-07-23 08:08:55 +0200
committerDavid S. Miller <davem@davemloft.net>2020-07-24 15:41:54 -0700
commitb03afaa82ece13b2a008f0e3a7127bead578e3e6 (patch)
treed34d7c6c990946d126e74053cdd8d37291dbe48e /net/ipv4/bpfilter
parentnetfilter: switch nf_setsockopt to sockptr_t (diff)
downloadwireguard-linux-b03afaa82ece13b2a008f0e3a7127bead578e3e6.tar.xz
wireguard-linux-b03afaa82ece13b2a008f0e3a7127bead578e3e6.zip
bpfilter: switch bpfilter_ip_set_sockopt to sockptr_t
This is mostly to prepare for cleaning up the callers, as bpfilter by design can't handle kernel pointers. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/bpfilter')
-rw-r--r--net/ipv4/bpfilter/sockopt.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/ipv4/bpfilter/sockopt.c b/net/ipv4/bpfilter/sockopt.c
index 9063c6767d34..1b34cb9a7708 100644
--- a/net/ipv4/bpfilter/sockopt.c
+++ b/net/ipv4/bpfilter/sockopt.c
@@ -21,8 +21,7 @@ void bpfilter_umh_cleanup(struct umd_info *info)
}
EXPORT_SYMBOL_GPL(bpfilter_umh_cleanup);
-static int bpfilter_mbox_request(struct sock *sk, int optname,
- char __user *optval,
+static int bpfilter_mbox_request(struct sock *sk, int optname, sockptr_t optval,
unsigned int optlen, bool is_set)
{
int err;
@@ -52,7 +51,7 @@ out:
return err;
}
-int bpfilter_ip_set_sockopt(struct sock *sk, int optname, char __user *optval,
+int bpfilter_ip_set_sockopt(struct sock *sk, int optname, sockptr_t optval,
unsigned int optlen)
{
return bpfilter_mbox_request(sk, optname, optval, optlen, true);
@@ -66,7 +65,8 @@ int bpfilter_ip_get_sockopt(struct sock *sk, int optname, char __user *optval,
if (get_user(len, optlen))
return -EFAULT;
- return bpfilter_mbox_request(sk, optname, optval, len, false);
+ return bpfilter_mbox_request(sk, optname, USER_SOCKPTR(optval), len,
+ false);
}
static int __init bpfilter_sockopt_init(void)