aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/bounds.c
diff options
context:
space:
mode:
authorAndrey Ignatov <rdna@fb.com>2019-12-18 23:44:33 -0800
committerAlexei Starovoitov <ast@kernel.org>2019-12-19 21:22:25 -0800
commit1020c1f24a946e7d5d8a67db741b20efcd2cefc5 (patch)
tree1278ba8083c8e54bcabcda5647247221a53c9982 /kernel/bounds.c
parentMerge branch 'simplify-do_redirect' (diff)
downloadlinux-dev-1020c1f24a946e7d5d8a67db741b20efcd2cefc5.tar.xz
linux-dev-1020c1f24a946e7d5d8a67db741b20efcd2cefc5.zip
bpf: Simplify __cgroup_bpf_attach
__cgroup_bpf_attach has a lot of identical code to handle two scenarios: BPF_F_ALLOW_MULTI is set and unset. Simplify it by splitting the two main steps: * First, the decision is made whether a new bpf_prog_list entry should be allocated or existing entry should be reused for the new program. This decision is saved in replace_pl pointer; * Next, replace_pl pointer is used to handle both possible states of BPF_F_ALLOW_MULTI flag (set / unset) instead of doing similar work for them separately. This splitting, in turn, allows to make further simplifications: * The check for attaching same program twice in BPF_F_ALLOW_MULTI mode can be done before allocating cgroup storage, so that if user tries to attach same program twice no alloc/free happens as it was before; * pl_was_allocated becomes redundant so it's removed. Signed-off-by: Andrey Ignatov <rdna@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Martin KaFai Lau <kafai@fb.com> Acked-by: Andrii Nakryiko <andriin@fb.com> Link: https://lore.kernel.org/bpf/c6193db6fe630797110b0d3ff06c125d093b834c.1576741281.git.rdna@fb.com
Diffstat (limited to 'kernel/bounds.c')
0 files changed, 0 insertions, 0 deletions