selftests/bpf: Fix bpf_object leak in skb_ctx selftest
authorAndrii Nakryiko <andrii@kernel.org>
Sun, 7 Nov 2021 16:55:21 +0000 (08:55 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 09:54:10 +0000 (10:54 +0100)
commita9d2ccfc7d2caa3bf2443dc0cf4cbfc56c3c9518
treee3514b26b8243d646b930a0f7f89131a7d32a301
parentb207356933f4593071bbd95da2bb12eaa762a66f
selftests/bpf: Fix bpf_object leak in skb_ctx selftest

[ Upstream commit 8c7a95520184b6677ca6075e12df9c208d57d088 ]

skb_ctx selftest didn't close bpf_object implicitly allocated by
bpf_prog_test_load() helper. Fix the problem by explicitly calling
bpf_object__close() at the end of the test.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Hengqi Chen <hengqi.chen@gmail.com>
Link: https://lore.kernel.org/bpf/20211107165521.9240-10-andrii@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/bpf/prog_tests/skb_ctx.c