testing/selftests/mqueue: Fix mq_perf_tests to free the allocated cpu set
authorAthira Rajeev <atrajeev@linux.vnet.ibm.com>
Fri, 8 Apr 2022 07:24:31 +0000 (12:54 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Apr 2022 07:34:12 +0000 (09:34 +0200)
commit7399ed8e6a8d37d75f29b10f4558fa8dc166aa61
treea4132ee6686bd36702a83a3dae792ea2acad147e
parent9947548d9cef58f6be28b7bb0be53138626ff319
testing/selftests/mqueue: Fix mq_perf_tests to free the allocated cpu set

[ Upstream commit ce64763c63854b4079f2e036638aa881a1fb3fbc ]

The selftest "mqueue/mq_perf_tests.c" use CPU_ALLOC to allocate
CPU set. This cpu set is used further in pthread_attr_setaffinity_np
and by pthread_create in the code. But in current code, allocated
cpu set is not freed.

Fix this issue by adding CPU_FREE in the "shutdown" function which
is called in most of the error/exit path for the cleanup. There are
few error paths which exit without using shutdown. Add a common goto
error path with CPU_FREE for these cases.

Fixes: 7820b0715b6f ("tools/selftests: add mq_perf_tests")
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/mqueue/mq_perf_tests.c