提交 1dafb1ac 编写于 作者: A Andrii Nakryiko 提交者: Zheng Zengkai

selftests/bpf: Fix bpf_object leak in skb_ctx selftest

stable inclusion
from stable-v5.10.94
commit a9d2ccfc7d2caa3bf2443dc0cf4cbfc56c3c9518
bugzilla: https://gitee.com/openeuler/kernel/issues/I531X9

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a9d2ccfc7d2caa3bf2443dc0cf4cbfc56c3c9518

--------------------------------

[ Upstream commit 8c7a9552 ]

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: NAndrii Nakryiko <andrii@kernel.org>
Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
Reviewed-by: NHengqi Chen <hengqi.chen@gmail.com>
Link: https://lore.kernel.org/bpf/20211107165521.9240-10-andrii@kernel.orgSigned-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 893aa02a
...@@ -105,4 +105,6 @@ void test_skb_ctx(void) ...@@ -105,4 +105,6 @@ void test_skb_ctx(void)
"ctx_out_mark", "ctx_out_mark",
"skb->mark == %u, expected %d\n", "skb->mark == %u, expected %d\n",
skb.mark, 10); skb.mark, 10);
bpf_object__close(obj);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册