[PATCH stalld 36/36] stalld: die on invalid CPU affinity
Wander Lairson Costa <[email protected]> Mon, 30 Mar 2026 16:43:59 -0300
| Newsgroups | org.kernel.vger.linux-rt-users |
|---|---|
| Message-ID | <[email protected]> |
set_cpu_affinity() validates the CPU list and returns -1 on error, but main() ignored the return value, allowing stalld to run with an invalid or empty affinity mask. Signed-off-by: Wander Lairson Costa <[email protected]> --- src/stalld.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/stalld.c b/src/stalld.c index b9372db..d95b48f 100644 --- a/src/stalld.c +++ b/src/stalld.c @@ -1166,11 +1166,9 @@ int main(int argc, char **argv) parse_args(argc, argv); - /* - * it will not die... - */ if (config_affinity_cpus) - set_cpu_affinity(config_affinity_cpus); + if (set_cpu_affinity(config_affinity_cpus)) + die("invalid CPU affinity: %s\n", config_affinity_cpus); if (!check_dl_server_dir_exists()) log_msg("DL-server detected.\n"); -- 2.53.0