From patchwork Wed Sep 25 07:05:03 2019 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: 11160095 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 3EA8E924 for ; Wed, 25 Sep 2019 07:06:43 +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 2382621D7C for ; Wed, 25 Sep 2019 07:06:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2382621D7C 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 1iD1ML-00080q-Nc; Wed, 25 Sep 2019 07:05:09 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iD1MK-00080f-5t for xen-devel@lists.xenproject.org; Wed, 25 Sep 2019 07:05:08 +0000 X-Inumbo-ID: cdd82066-df62-11e9-bf31-bc764e2007e4 Received: from mx1.suse.de (unknown [195.135.220.15]) by localhost (Halon) with ESMTPS id cdd82066-df62-11e9-bf31-bc764e2007e4; Wed, 25 Sep 2019 07:05:07 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 3B5A6AF10; Wed, 25 Sep 2019 07:05:06 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Wed, 25 Sep 2019 09:05:03 +0200 Message-Id: <20190925070503.13850-3-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190925070503.13850-1-jgross@suse.com> References: <20190925070503.13850-1-jgross@suse.com> Subject: [Xen-devel] [PATCH 2/2] xen/sched: fix freeing per-vcpu data in sched_move_domain() 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 of an allocation error of per-vcpu data in sched_move_domain() the already allocated data is freed just using xfree(). This is wrong as some schedulers need to do additional operations (e.g. the arinc653 scheduler needs to remove the vcpu-data from a list). So instead xfree() make use of the sched_free_vdata() hook. Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich Reviewed-by: Dario Faggioli --- xen/common/schedule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 13b5ffc7cf..13c17fe944 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -386,7 +386,7 @@ int sched_move_domain(struct domain *d, struct cpupool *c) if ( vcpu_priv[v->vcpu_id] == NULL ) { for_each_vcpu ( d, v ) - xfree(vcpu_priv[v->vcpu_id]); + sched_free_vdata(c->sched, vcpu_priv[v->vcpu_id]); xfree(vcpu_priv); sched_free_domdata(c->sched, domdata); return -ENOMEM;