]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: offload: free program id when device disappears
authorJakub Kicinski <jakub.kicinski@netronome.com>
Thu, 28 Dec 2017 02:39:07 +0000 (18:39 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Sun, 31 Dec 2017 15:12:23 +0000 (16:12 +0100)
commitb1ee6164c482ac0e3cc69d695cd36dd39da5efdf
tree0381e442d0e7c6271548366931ab662806711627
parent3949c752fb79ab3d1ad39d5afb5f5cf39d2057f1
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>
include/linux/bpf.h
kernel/bpf/offload.c
kernel/bpf/syscall.c