summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2023-09-19 15:26:35 +0200
committerHelge Deller <deller@gmx.de>2023-10-07 20:30:16 +0200
commitd3b3c637e4eb8d3bbe53e5692aee66add72f9851 (patch)
treef3e10c8ecd01b63132097670cdfde69d92e57b2a
parentce9ecca0238b140b88f43859b211c9fdfd8e5b70 (diff)
parisc: Fix crash with nr_cpus=1 option
John David Anglin reported that giving "nr_cpus=1" on the command line causes a crash, while "maxcpus=1" works. Reported-by: John David Anglin <dave.anglin@bell.net> Signed-off-by: Helge Deller <deller@gmx.de> Cc: stable@vger.kernel.org # v5.18+
-rw-r--r--arch/parisc/kernel/smp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c
index 4098f9a0964b..2019c1f04bd0 100644
--- a/arch/parisc/kernel/smp.c
+++ b/arch/parisc/kernel/smp.c
@@ -440,7 +440,9 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
if (cpu_online(cpu))
return 0;
- if (num_online_cpus() < setup_max_cpus && smp_boot_one_cpu(cpu, tidle))
+ if (num_online_cpus() < nr_cpu_ids &&
+ num_online_cpus() < setup_max_cpus &&
+ smp_boot_one_cpu(cpu, tidle))
return -EIO;
return cpu_online(cpu) ? 0 : -EIO;