diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2017-12-27 18:39:07 -0800 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2017-12-31 16:12:23 +0100 |
commit | ad8ad79f4f6078f456792f7f8d344da2be9bc74f (patch) | |
tree | 0381e442d0e7c6271548366931ab662806711627 /include/linux/bpf.h | |
parent | ce3b9db4db0e0e2b9761c56d08615ea0159e4a1b (diff) | |
download | linux-stable-ad8ad79f4f6078f456792f7f8d344da2be9bc74f.tar.gz linux-stable-ad8ad79f4f6078f456792f7f8d344da2be9bc74f.tar.bz2 linux-stable-ad8ad79f4f6078f456792f7f8d344da2be9bc74f.zip |
bpf: offload: free program id when device disappears
Bound programs are quite useless after their device disappears.
They are simply waiting for reference count to go to zero,
don't list them in BPF_PROG_GET_NEXT_ID by freeing their ID
early.
Note that orphaned offload programs will return -ENODEV on
BPF_OBJ_GET_INFO_BY_FD so user will never see ID 0.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'include/linux/bpf.h')
-rw-r--r-- | include/linux/bpf.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 669549f7e3e8..9a916ab34299 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -357,6 +357,8 @@ void bpf_prog_put(struct bpf_prog *prog); int __bpf_prog_charge(struct user_struct *user, u32 pages); void __bpf_prog_uncharge(struct user_struct *user, u32 pages); +void bpf_prog_free_id(struct bpf_prog *prog, bool do_idr_lock); + struct bpf_map *bpf_map_get_with_uref(u32 ufd); struct bpf_map *__bpf_map_get(struct fd f); struct bpf_map * __must_check bpf_map_inc(struct bpf_map *map, bool uref); |