From nobody Tue Feb 10 12:09:37 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1614337026; cv=none; d=zohomail.com; s=zohoarc; b=F/2YC5/f78Lz5fwvDYagLcZSwgE/P+f57fg8gZ+TfHdxqHbclfOBRWtc8ZaRgi5dODK2Tkw5QxbtY407EVPyr5eJxD/RAPi9QpzgrmIycAkq+Y5BvNLPCSGMwnblAKm1t6G1cZI42GmuNouYHe0TXHnU6XpuHAYhFsoDv7WA/YM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614337026; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=rKYi+qEerpdW0l9C/Ph4WyNn/j7ZcEQ39HY+quniLnM=; b=U4twhsvcMEDM2CdMdR1WRDUSoX/1vFHuMIGHXUq7lSCrpCKJ3rWPypA8BC0XJQXn6JbwHN0vrbU7OutuMWeYzAZKk9lzwWBJ7C9YsJBnX2j0CaLRfFKmgoSuMfsnsPPkaLeqPOqLoVtqMpqJ283J9V3w6M+Rgbfn14PP3IEZUtc= 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1614337026492218.90470654912633; Fri, 26 Feb 2021 02:57:06 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.90207.170709 (Exim 4.92) (envelope-from ) id 1lFanf-0003GN-HI; Fri, 26 Feb 2021 10:56:47 +0000 Received: by outflank-mailman (output) from mailman id 90207.170709; Fri, 26 Feb 2021 10:56:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lFanf-0003GG-EJ; Fri, 26 Feb 2021 10:56:47 +0000 Received: by outflank-mailman (input) for mailman id 90207; Fri, 26 Feb 2021 10:56:46 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lFane-0003G6-3M for xen-devel@lists.xenproject.org; Fri, 26 Feb 2021 10:56:46 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lFand-0001Q1-0d; Fri, 26 Feb 2021 10:56:45 +0000 Received: from 54-240-197-235.amazon.com ([54.240.197.235] helo=ufe34d9ed68d054.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lFanc-0007D9-L1; Fri, 26 Feb 2021 10:56:44 +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" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=rKYi+qEerpdW0l9C/Ph4WyNn/j7ZcEQ39HY+quniLnM=; b=qmqpY3hlJJfHrB2Ax1D3efsBe yoN5ARL4gbcbIK5Dn9bBEsnTxyBAxbypT2+zuRR1UcrFCc0+Mfl9Dh+7XlsArwb2ceshWljLHAluA 3X7ihp4IQxkw1KPLbwgWUZ/aW8GATDVM4c3uNTEoWRBOnogXSsCrF0jb+NQI+YIqmcPfY=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: hongyxia@amazon.co.uk, iwj@xenproject.org, Julien Grall , Jan Beulich , Paul Durrant Subject: [PATCH for-4.15 v5 1/3] xen/iommu: x86: Don't try to free page tables is the IOMMU is not enabled Date: Fri, 26 Feb 2021 10:56:38 +0000 Message-Id: <20210226105640.12037-2-julien@xen.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210226105640.12037-1-julien@xen.org> References: <20210226105640.12037-1-julien@xen.org> X-ZohoMail-DKIM: pass (identity @xen.org) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Julien Grall When using CONFIG_BIGMEM=3Dy, the page_list cannot be accessed whilst it is is unitialized. However, iommu_free_pgtables() will be called even if the domain is not using an IOMMU. Consequently, Xen will try to go through the page list and deference a NULL pointer. Bail out early if the domain is not using an IOMMU. Fixes: 15bc9a1ef51c ("x86/iommu: add common page-table allocator") Signed-off-by: Julien Grall Reviewed-by: Jan Beulich --- Changes in v5: - Patch added. This was split from "xen/x86: iommu: Ignore IOMMU mapping requests when a domain is dying" --- xen/drivers/passthrough/x86/iommu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/= x86/iommu.c index cea1032b3d02..58a330e82247 100644 --- a/xen/drivers/passthrough/x86/iommu.c +++ b/xen/drivers/passthrough/x86/iommu.c @@ -267,6 +267,9 @@ int iommu_free_pgtables(struct domain *d) struct page_info *pg; unsigned int done =3D 0; =20 + if ( !is_iommu_enabled(d) ) + return 0; + while ( (pg =3D page_list_remove_head(&hd->arch.pgtables.list)) ) { free_domheap_page(pg); --=20 2.17.1