[PATCH v2] sched/isolation: avoid reading past string in isolcpus parser

From: Joseph Salisbury

Date: Mon Mar 09 2026 - 18:02:43 EST


The function housekeeping_isolcpus_setup() advanced the parser pointer
unconditionally after unknown flags.

For an argument like 'isolcpus=unknownflag', with no trailing
comma, this can move the pointer past the terminating NUL, and
the next loop test reads out of bounds.

Reproducer:
isolcpus=unknownflag

Advance only when the parser is not already at the terminating NUL,
preserving existing parsing semantics while avoiding the invalid read.

Fixes: 3662daf02350 ("sched/isolation: Allow "isolcpus=" to skip unknown sub-parameters")
Cc: stable@xxxxxxxxxxxxxxx
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Assisted-by: Codex:GPT-5
Signed-off-by: Joseph Salisbury <joseph.salisbury@xxxxxxxxxx>
---
v2:
- Advance past any non-NUL separator instead of checking specifically
for ','.

kernel/sched/isolation.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
index ef152d401fe2..402a1e335277 100644
--- a/kernel/sched/isolation.c
+++ b/kernel/sched/isolation.c
@@ -355,7 +355,8 @@ static int __init housekeeping_isolcpus_setup(char *str)
}

pr_info("isolcpus: Skipped unknown flag %.*s\n", len, par);
- str++;
+ if (*str)
+ str++;
}

/* Default behaviour for isolcpus without flags */
--
2.47.3