]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: introduce update_effective_progs()
authorRoman Gushchin <guro@fb.com>
Mon, 6 Aug 2018 21:27:28 +0000 (14:27 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 7 Aug 2018 12:29:55 +0000 (14:29 +0200)
commit3f251101df7ea0b9561adc7534e84c1af8ec0fa5
treeed5bc8047c6756f9abb36933aeff50e21ea76737
parent03630e54f34ed5abc01068efa244a8f85124785d
bpf: introduce update_effective_progs()

__cgroup_bpf_attach() and __cgroup_bpf_detach() functions have
a good amount of duplicated code, which is possible to eliminate
by introducing the update_effective_progs() helper function.

The update_effective_progs() calls compute_effective_progs()
and then in case of success it calls activate_effective_progs()
for each descendant cgroup. In case of failure (OOM), it releases
allocated prog arrays and return the error code.

Signed-off-by: Roman Gushchin <guro@fb.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
kernel/bpf/cgroup.c