Skip to content

Commit d200cf6

Browse files
Christoph Hellwigdavem330
authored andcommitted
bpfilter: reject kernel addresses
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]>
1 parent c9ffebd commit d200cf6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/bpfilter/bpfilter_kern.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ static int bpfilter_process_sockopt(struct sock *sk, int optname,
7070
.addr = (uintptr_t)optval,
7171
.len = optlen,
7272
};
73+
if (uaccess_kernel()) {
74+
pr_err("kernel access not supported\n");
75+
return -EFAULT;
76+
}
7377
return bpfilter_send_req(&req);
7478
}
7579

0 commit comments

Comments
 (0)