diff options
author | Nathan Lynch <nathanl@linux.ibm.com> | 2021-09-27 22:19:31 +0200 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2021-10-08 15:16:00 +0200 |
commit | 983f9101740641434cea4f2e172175ff4b0276ad (patch) | |
tree | b3b2b981e1158fb4d7c9a5b1e74c806d5aa0e3d4 /arch/powerpc/kernel/sysfs.c | |
parent | powerpc/pseries/cpuhp: cache node corrections (diff) | |
download | linux-983f9101740641434cea4f2e172175ff4b0276ad.tar.xz linux-983f9101740641434cea4f2e172175ff4b0276ad.zip |
powerpc/cpuhp: BUG -> WARN conversion in offline path
If, due to bugs elsewhere, we get into unregister_cpu_online() with a CPU
that isn't marked hotpluggable, we can emit a warning and return an
appropriate error instead of crashing.
Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210927201933.76786-3-nathanl@linux.ibm.com
Diffstat (limited to 'arch/powerpc/kernel/sysfs.c')
-rw-r--r-- | arch/powerpc/kernel/sysfs.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c index defecb3b1b15..08d8072d6e7a 100644 --- a/arch/powerpc/kernel/sysfs.c +++ b/arch/powerpc/kernel/sysfs.c @@ -928,7 +928,8 @@ static int unregister_cpu_online(unsigned int cpu) struct device_attribute *attrs, *pmc_attrs; int i, nattrs; - BUG_ON(!c->hotpluggable); + if (WARN_RATELIMIT(!c->hotpluggable, "cpu %d can't be offlined\n", cpu)) + return -EBUSY; #ifdef CONFIG_PPC64 if (cpu_has_feature(CPU_FTR_SMT)) |