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>
This commit is contained in:
Christoph Hellwig
2020-07-23 08:08:55 +02:00
committed by David S. Miller
parent c2f12630c6
commit b03afaa82e
4 changed files with 12 additions and 11 deletions

View File

@@ -60,17 +60,17 @@ stop:
}
static int bpfilter_process_sockopt(struct sock *sk, int optname,
char __user *optval, unsigned int optlen,
sockptr_t optval, unsigned int optlen,
bool is_set)
{
struct mbox_request req = {
.is_set = is_set,
.pid = current->pid,
.cmd = optname,
.addr = (uintptr_t)optval,
.addr = (uintptr_t)optval.user,
.len = optlen,
};
if (uaccess_kernel()) {
if (uaccess_kernel() || sockptr_is_kernel(optval)) {
pr_err("kernel access not supported\n");
return -EFAULT;
}