]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
parisc: Fix crash with nr_cpus=1 option
authorHelge Deller <deller@gmx.de>
Tue, 19 Sep 2023 13:26:35 +0000 (15:26 +0200)
committerHelge Deller <deller@gmx.de>
Sat, 7 Oct 2023 18:30:16 +0000 (20:30 +0200)
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+
arch/parisc/kernel/smp.c

index 4098f9a0964b9b8741c533acce88cb018b844c6a..2019c1f04bd037af0d346f4c4e03f42c769eb16f 100644 (file)
@@ -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;