]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Fix removal of inner map in bpf_object__create_map
authorMartynas Pumputis <m@lambda.lt>
Mon, 19 Jul 2021 17:38:37 +0000 (19:38 +0200)
committerAndrii Nakryiko <andrii@kernel.org>
Mon, 19 Jul 2021 22:48:20 +0000 (15:48 -0700)
commit0967d6fc75c48db02ba5386ca5fef09744b44b88
tree5a6fd6fbc93e3cea9b9322980972ab28238da08d
parenta18348e08e72bd1fcddd3e35ef69b18ea66bce06
libbpf: Fix removal of inner map in bpf_object__create_map

If creating an outer map of a BTF-defined map-in-map fails (via
bpf_object__create_map()), then the previously created its inner map
won't be destroyed.

Fix this by ensuring that the destroy routines are not bypassed in the
case of a failure.

Fixes: daad13a891eac ("libbpf: Add BTF-defined map-in-map support")
Reported-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Martynas Pumputis <m@lambda.lt>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20210719173838.423148-2-m@lambda.lt
tools/lib/bpf/libbpf.c