diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2015-10-29 14:58:07 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-11-02 22:48:39 -0500 |
commit | c210129760a010b555372ef74f4e1a46d4eb8a22 (patch) | |
tree | 89e51ef793586fa8a752674d59aea233f1a68283 /kernel/bpf/verifier.c | |
parent | aa79781b65b9cf79807ade78f2703f5e9402c336 (diff) | |
download | lwn-c210129760a010b555372ef74f4e1a46d4eb8a22.tar.gz lwn-c210129760a010b555372ef74f4e1a46d4eb8a22.zip |
bpf: align and clean bpf_{map,prog}_get helpers
Add a bpf_map_get() function that we're going to use later on and
align/clean the remaining helpers a bit so that we have them a bit
more consistent:
- __bpf_map_get() and __bpf_prog_get() that both work on the fd
struct, check whether the descriptor is eBPF and return the
pointer to the map/prog stored in the private data.
Also, we can return f.file->private_data directly, the function
signature is enough of a documentation already.
- bpf_map_get() and bpf_prog_get() that both work on u32 user fd,
call their respective __bpf_map_get()/__bpf_prog_get() variants,
and take a reference.
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/bpf/verifier.c')
-rw-r--r-- | kernel/bpf/verifier.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index b56cf51f8d42..fdc88c5a60e3 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -1989,8 +1989,7 @@ static int replace_map_fd_with_map_ptr(struct verifier_env *env) } f = fdget(insn->imm); - - map = bpf_map_get(f); + map = __bpf_map_get(f); if (IS_ERR(map)) { verbose("fd %d is not pointing to valid bpf_map\n", insn->imm); |