From: Juergen Gross Date: Fri, 8 May 2020 08:44:22 +0000 (+0200) Subject: cpupool: fix removing cpu from a cpupool X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~293 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=498d73647fa17d9eb7a67d2e9bdccac6b438e559;p=xen.git cpupool: fix removing cpu from a cpupool Commit cb563d7665f2 ("xen/sched: support core scheduling for moving cpus to/from cpupools") introduced a regression when trying to remove an offline cpu from a cpupool, as the system would crash in this situation. Fix that by testing the cpu to be online. Fixes: cb563d7665f2 ("xen/sched: support core scheduling for moving cpus to/from cpupools") Signed-off-by: Juergen Gross Acked-by: Dario Faggioli --- diff --git a/xen/common/sched/cpupool.c b/xen/common/sched/cpupool.c index 97c2d5b3c1..0664f7fa3d 100644 --- a/xen/common/sched/cpupool.c +++ b/xen/common/sched/cpupool.c @@ -552,6 +552,9 @@ static int cpupool_unassign_cpu(struct cpupool *c, unsigned int cpu) debugtrace_printk("cpupool_unassign_cpu(pool=%d,cpu=%d)\n", c->cpupool_id, cpu); + if ( !cpu_online(cpu) ) + return -EINVAL; + master_cpu = sched_get_resource_cpu(cpu); ret = cpupool_unassign_cpu_start(c, master_cpu); if ( ret )