From nobody Wed May 8 01:59:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1630926084; cv=none; d=zohomail.com; s=zohoarc; b=S/P6GMdu0trYc3rcWI+Nr3VUrRE+7cZ3eth3Opx7JOaKy9/1CPGfYowXQXY++gouQvHAP9QTRJYYWscNMC2pThIv+Fm80yMOWJmduYirGegTnTvRfDuvWRu6J44CKvZFcdCHTB6oF25kYCgJs34K2So8FY9kxCQ9lBilY5I3a3I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630926084; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=BrS40Tf/KPD9CQCWVNVJ4t3+lx1YVOcmmtx8WpJDnlY=; b=WOpoOGIdsB8O+rgsKL9Of/vvkRhB22Tswa0Ao0T+5TkgwqEjZgrHw/mkxoDCU5Bo9y0FzFa6eWWOpdr9Ry6AhZJppJloLQWrL/iS+7cBZeeq73JRJRpxNATlJrcpzNyNYBxH5/PQJ2QN/8bw9uvPmkxb3AId7lNBuYOFY0vEwkM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1630926084468393.2471477989643; Mon, 6 Sep 2021 04:01:24 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.179627.325993 (Exim 4.92) (envelope-from ) id 1mNCN8-00082G-4O; Mon, 06 Sep 2021 11:01:06 +0000 Received: by outflank-mailman (output) from mailman id 179627.325993; Mon, 06 Sep 2021 11:01:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mNCN8-000829-1F; Mon, 06 Sep 2021 11:01:06 +0000 Received: by outflank-mailman (input) for mailman id 179627; Mon, 06 Sep 2021 11:01:05 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mNCN7-000823-0l for xen-devel@lists.xenproject.org; Mon, 06 Sep 2021 11:01:05 +0000 Received: from smtp-out1.suse.de (unknown [195.135.220.28]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b655369a-290f-481c-ae76-3e0f87498c2b; Mon, 06 Sep 2021 11:01:04 +0000 (UTC) Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 6D415220EA; Mon, 6 Sep 2021 11:01:03 +0000 (UTC) Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap1.suse-dmz.suse.de (Postfix) with ESMTPS id 3298213942; Mon, 6 Sep 2021 11:01:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id gFtICu/0NWFbGQAAGKfGzw (envelope-from ); Mon, 06 Sep 2021 11:01:03 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b655369a-290f-481c-ae76-3e0f87498c2b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1630926063; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=BrS40Tf/KPD9CQCWVNVJ4t3+lx1YVOcmmtx8WpJDnlY=; b=bejh5fc5k+w1U6ChtsJEM6gYGML9shAdNIMcvQWDi+PEXtdSQJBOTjexaAnNTUqHjpiSNi VTRoOLFZWRlX8K7yRTmMpcpyPzKYfkpiFOQt4dNDzOGWujkiLaoTiIs//4sRYDI9LHd45i gzOgfWigAns23QVOD9Zgar5PfP5VXfk= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , George Dunlap , Dario Faggioli , Bertrand Marquis Subject: [PATCH] xen/sched: fix sched_move_domain() for domain without vcpus Date: Mon, 6 Sep 2021 13:00:57 +0200 Message-Id: <20210906110057.15384-1-jgross@suse.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1630926102596100001 Content-Type: text/plain; charset="utf-8" In case a domain is created with a cpupool other than Pool-0 specified it will be moved to that cpupool before any vcpus are allocated. This will lead to a NULL pointer dereference in sched_move_domain(). Fix that by tolerating vcpus not being allocated yet. Fixes: 70fadc41635b9b6 ("xen/cpupool: support moving domain between cpupool= s with different granularity") Reported-by: Bertrand Marquis Reviewed-by: Bertrand Marquis Signed-off-by: Juergen Gross --- xen/common/sched/core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index 8d178baf3d..79c9100680 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -671,6 +671,10 @@ int sched_move_domain(struct domain *d, struct cpupool= *c) =20 for ( unit_idx =3D 0; unit_idx < n_units; unit_idx++ ) { + /* Special case for move at domain creation time. */ + if ( !d->vcpu[unit_idx * gran] ) + break; + unit =3D sched_alloc_unit_mem(); if ( unit ) { --=20 2.26.2