Skip to content

Commit

Permalink
bpfilter: reject kernel addresses
Browse files Browse the repository at this point in the history
The bpfilter user mode helper processes the optval address using
process_vm_readv.  Don't send it kernel addresses fed under
set_fs(KERNEL_DS) as that won't work.

Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Christoph Hellwig authored and davem330 committed Jul 24, 2020
1 parent c9ffebd commit d200cf6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/bpfilter/bpfilter_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ static int bpfilter_process_sockopt(struct sock *sk, int optname,
.addr = (uintptr_t)optval,
.len = optlen,
};
if (uaccess_kernel()) {
pr_err("kernel access not supported\n");
return -EFAULT;
}
return bpfilter_send_req(&req);
}

Expand Down

0 comments on commit d200cf6

Please sign in to comment.