mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 10:00:03 -04:00
selftests/bpf: Fix incorrect error checking for pthread_create
pthread_create returns 0 on success and a positive error code on failure;
it never returns a negative value. The current conditional branch can never be taken.
Failures during thread creation are silently ignored, which will lead to
invalid memory access when waiting on threads or dereferencing thread handles later.
Fixes: 91b2c0afd0 ("selftests/bpf: Add parallelism to test_progs")
Signed-off-by: Feng Yang <yangfeng@kylinos.cn>
Link: https://lore.kernel.org/bpf/20260723085100.482147-3-yangfeng59949@163.com
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
This commit is contained in:
committed by
Kumar Kartikeya Dwivedi
parent
791841e038
commit
b04b8d4e19
@@ -1741,7 +1741,7 @@ static void server_main(void)
|
||||
data[i].worker_id = i;
|
||||
data[i].sock_fd = env.worker_socks[i];
|
||||
rc = pthread_create(&dispatcher_threads[i], NULL, dispatch_thread, &data[i]);
|
||||
if (rc < 0) {
|
||||
if (rc) {
|
||||
perror("Failed to launch dispatcher thread");
|
||||
exit(EXIT_ERR_SETUP_INFRA);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user