* [Xen-devel] [PATCH v2] xen/sched: fix error path in cpupool_unassign_cpu_start()
@ 2020-03-03 9:27 Juergen Gross
2020-03-03 13:49 ` Dario Faggioli
0 siblings, 1 reply; 2+ messages in thread
From: Juergen Gross @ 2020-03-03 9:27 UTC (permalink / raw)
To: xen-devel; +Cc: Juergen Gross, George Dunlap, Dario Faggioli
In case moving away all domains from the cpu to be removed is failing
in cpupool_unassign_cpu_start() the error path is missing to release
sched_res_rculock.
The normal exit path is releasing domlist_read_lock instead (this is
currently no problem as the reference to the specific rcu lock is not
used by rcu_read_unlock()).
While at it indent the present error label by one space.
Reported-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
V2:
- indent error labels (Jan Beulich)
---
xen/common/sched/cpupool.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/xen/common/sched/cpupool.c b/xen/common/sched/cpupool.c
index b7721b5d02..9f70c7ec17 100644
--- a/xen/common/sched/cpupool.c
+++ b/xen/common/sched/cpupool.c
@@ -466,7 +466,7 @@ static int cpupool_unassign_cpu_start(struct cpupool *c, unsigned int cpu)
}
rcu_read_unlock(&domlist_read_lock);
if ( ret )
- goto out;
+ goto out_rcu;
}
cpupool_moving_cpu = cpu;
atomic_inc(&c->refcnt);
@@ -474,8 +474,9 @@ static int cpupool_unassign_cpu_start(struct cpupool *c, unsigned int cpu)
cpumask_andnot(c->cpu_valid, c->cpu_valid, cpus);
cpumask_and(c->res_valid, c->cpu_valid, &sched_res_mask);
- rcu_read_unlock(&domlist_read_lock);
-out:
+ out_rcu:
+ rcu_read_unlock(&sched_res_rculock);
+ out:
spin_unlock(&cpupool_lock);
return ret;
--
2.16.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Xen-devel] [PATCH v2] xen/sched: fix error path in cpupool_unassign_cpu_start()
2020-03-03 9:27 [Xen-devel] [PATCH v2] xen/sched: fix error path in cpupool_unassign_cpu_start() Juergen Gross
@ 2020-03-03 13:49 ` Dario Faggioli
0 siblings, 0 replies; 2+ messages in thread
From: Dario Faggioli @ 2020-03-03 13:49 UTC (permalink / raw)
To: Juergen Gross, xen-devel; +Cc: George Dunlap
[-- Attachment #1.1: Type: text/plain, Size: 965 bytes --]
On Tue, 2020-03-03 at 10:27 +0100, Juergen Gross wrote:
> In case moving away all domains from the cpu to be removed is failing
> in cpupool_unassign_cpu_start() the error path is missing to release
> sched_res_rculock.
>
> The normal exit path is releasing domlist_read_lock instead (this is
> currently no problem as the reference to the specific rcu lock is not
> used by rcu_read_unlock()).
>
> While at it indent the present error label by one space.
>
> Reported-by: Igor Druzhinin <igor.druzhinin@citrix.com>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
Regards
--
Dario Faggioli, Ph.D
http://about.me/dario.faggioli
Virtualization Software Engineer
SUSE Labs, SUSE https://www.suse.com/
-------------------------------------------------------------------
<<This happens because _I_ choose it to happen!>> (Raistlin Majere)
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 157 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-03 13:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-03 9:27 [Xen-devel] [PATCH v2] xen/sched: fix error path in cpupool_unassign_cpu_start() Juergen Gross
2020-03-03 13:49 ` Dario Faggioli
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.