]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Fix cgroup ref leak in cgroup_bpf_inherit on out-of-memory
authorAndrii Nakryiko <andriin@fb.com>
Mon, 9 Mar 2020 22:40:17 +0000 (15:40 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Apr 2020 09:02:04 +0000 (11:02 +0200)
commitcec7356f8f95d35833326a4c1c33f7cccbffd3c3
tree7485a9a568baae704cfc1228fccb361ae31e2839
parent6a8b877b123e71916cb2b163fd1945386aa7bb58
bpf: Fix cgroup ref leak in cgroup_bpf_inherit on out-of-memory

commit a21d13991649759b86b2d871a30e8b8e13a62369 upstream.

There is no compensating cgroup_bpf_put() for each ancestor cgroup in
cgroup_bpf_inherit(). If compute_effective_progs returns error, those cgroups
won't be freed ever. Fix it by putting them in cleanup code path.

Fixes: 1d657688841a ("bpf: cgroup: prevent out-of-order release of cgroup bpf")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Roman Gushchin <guro@fb.com>
Link: https://lore.kernel.org/bpf/20200309224017.1063297-1-andriin@fb.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/bpf/cgroup.c