Skip to content

Commit

Permalink
selftests/bpf: Fix potential unreleased lock
Browse files Browse the repository at this point in the history
[ 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>
  • Loading branch information
Y-chav authored and gregkh committed Sep 18, 2021
1 parent 10e1b6c commit 2d1209b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c
Expand Up @@ -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);

Expand Down

0 comments on commit 2d1209b

Please sign in to comment.