From: Geliang Tang <tanggeliang@xxxxxxxxxx> As Martin mentioned in review comment, there is an existing bug that orig_netns_fd will be leaked in the later "goto fail;" case after open("/proc/self/ns/net") in open_netns() in network_helpers.c. This patch adds "close(token->orig_netns_fd);" before "free(token);" to fix it. Fixes: a30338840fa5 ("selftests/bpf: Move open_netns() and close_netns() into network_helpers.c") Signed-off-by: Geliang Tang <tanggeliang@xxxxxxxxxx> --- tools/testing/selftests/bpf/network_helpers.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/bpf/network_helpers.c b/tools/testing/selftests/bpf/network_helpers.c index 9d63d2ac13d8..b2f531a6a4c7 100644 --- a/tools/testing/selftests/bpf/network_helpers.c +++ b/tools/testing/selftests/bpf/network_helpers.c @@ -478,6 +478,7 @@ struct nstoken *open_netns(const char *name) return token; fail: + close(token->orig_netns_fd); free(token); return NULL; } -- 2.40.1