Skip to content

Commit b1d547f

Browse files
Ychamegregkh
authored andcommitted
selftests/bpf: Fix potential unreleased lock
[ Upstream commit 47bb27a ] 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>
1 parent 3ad66d6 commit b1d547f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,10 @@ static void run_test(int cgroup_fd)
195195

196196
pthread_mutex_lock(&server_started_mtx);
197197
if (CHECK_FAIL(pthread_create(&tid, NULL, server_thread,
198-
(void *)&server_fd)))
198+
(void *)&server_fd))) {
199+
pthread_mutex_unlock(&server_started_mtx);
199200
goto close_server_fd;
201+
}
200202
pthread_cond_wait(&server_started, &server_started_mtx);
201203
pthread_mutex_unlock(&server_started_mtx);
202204

0 commit comments

Comments
 (0)