[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200619141716.299527080@linuxfoundation.org>
Date: Fri, 19 Jun 2020 16:30:44 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Andrii Nakryiko <andriin@...com>,
Alexei Starovoitov <ast@...nel.org>,
Carlos Neira <cneirabustos@...il.com>,
Sasha Levin <sashal@...nel.org>
Subject: [PATCH 5.7 126/376] selftests/bpf: Fix bpf_link leak in ns_current_pid_tgid selftest
From: Andrii Nakryiko <andriin@...com>
[ Upstream commit 8d30e80a049ad699264e4a12911e349f93c7279a ]
If condition is inverted, but it's also just not necessary.
Fixes: 1c1052e0140a ("tools/testing/selftests/bpf: Add self-tests for new helper bpf_get_ns_current_pid_tgid.")
Signed-off-by: Andrii Nakryiko <andriin@...com>
Signed-off-by: Alexei Starovoitov <ast@...nel.org>
Cc: Carlos Neira <cneirabustos@...il.com>
Link: https://lore.kernel.org/bpf/20200429012111.277390-11-andriin@fb.com
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c b/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c
index 542240e16564..e74dc501b27f 100644
--- a/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c
+++ b/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c
@@ -80,9 +80,6 @@ void test_ns_current_pid_tgid(void)
"User pid/tgid %llu BPF pid/tgid %llu\n", id, bss.pid_tgid))
goto cleanup;
cleanup:
- if (!link) {
- bpf_link__destroy(link);
- link = NULL;
- }
+ bpf_link__destroy(link);
bpf_object__close(obj);
}
--
2.25.1
Powered by blists - more mailing lists