summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChengfeng Ye <cyeaa@connect.ust.hk>2021-08-27 10:41:40 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-09-18 14:42:19 +0300
commitfd33ac568455c13727c364e908cae3916e38fbb6 (patch)
tree860baa16448c10503a483df11c9b4af046fd0f2f
parent1d95afd5f78e5f9018c340eda88f750f6c269458 (diff)
downloadlinux-fd33ac568455c13727c364e908cae3916e38fbb6.tar.xz
selftests/bpf: Fix potential unreleased lock
[ Upstream commit 47bb27a20d6ea22cd092c1fc2bb4fcecac374838 ] This lock is not released if the program return at the patched branch. Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20210827074140.118671-1-cyeaa@connect.ust.hk Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c b/tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c
index ec281b0363b8..86f97681ad89 100644
--- a/tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c
+++ b/tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c
@@ -195,8 +195,10 @@ static void run_test(int cgroup_fd)
pthread_mutex_lock(&server_started_mtx);
if (CHECK_FAIL(pthread_create(&tid, NULL, server_thread,
- (void *)&server_fd)))
+ (void *)&server_fd))) {
+ pthread_mutex_unlock(&server_started_mtx);
goto close_server_fd;
+ }
pthread_cond_wait(&server_started, &server_started_mtx);
pthread_mutex_unlock(&server_started_mtx);