From patchwork Tue Mar 3 08:03:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 11417341 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 61ACD14E3 for ; Tue, 3 Mar 2020 08:04:15 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 475BF2064A for ; Tue, 3 Mar 2020 08:04:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 475BF2064A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j92WA-0005Y0-Oz; Tue, 03 Mar 2020 08:03:06 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j92W8-0005Xs-UV for xen-devel@lists.xenproject.org; Tue, 03 Mar 2020 08:03:04 +0000 X-Inumbo-ID: 66ff7e5d-5d25-11ea-a09c-12813bfff9fa Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 66ff7e5d-5d25-11ea-a09c-12813bfff9fa; Tue, 03 Mar 2020 08:03:03 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 43579AC1D; Tue, 3 Mar 2020 08:03:02 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Tue, 3 Mar 2020 09:03:00 +0100 Message-Id: <20200303080300.12467-1-jgross@suse.com> X-Mailer: git-send-email 2.16.4 Subject: [Xen-devel] [PATCH] xen/sched: fix error path in cpupool_unassign_cpu_start() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , George Dunlap , Dario Faggioli MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" 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()). Reported-by: Igor Druzhinin Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich --- xen/common/sched/cpupool.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/common/sched/cpupool.c b/xen/common/sched/cpupool.c index b7721b5d02..4bf3d8434d 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,7 +474,8 @@ 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_rcu: + rcu_read_unlock(&sched_res_rculock); out: spin_unlock(&cpupool_lock);