From patchwork Tue Sep 4 19:21:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 145948 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp4051880ljw; Tue, 4 Sep 2018 12:24:33 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbTk2dF8MJ2ScV6UyEuaTC/0QbUTVkdkwWpz3UzikuWFgXoryDV2wa4mQdg7t2A1tBv/H4r X-Received: by 2002:ac8:690b:: with SMTP id e11-v6mr31472784qtr.214.1536089073125; Tue, 04 Sep 2018 12:24:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536089073; cv=none; d=google.com; s=arc-20160816; b=IoOjqg7U6nXM+z7iydUx6/sLDR7N4A7xHS1ZpO0pCZFM3/CLP2hVEFk3W556DIWUZE zpX7JS/u22v0M7bNPQyPIv65fsjap29kI4UxPKdOBhTqGRIVRNwETMQiWrwHgWlKnOhK 6XQKKBJEHnF5Qrrj2do9MlfDToaG5LiNVqAIejCAm8iCaPH0C4cO/t+lYvRJAjaWtFV/ 8a9GbfvDYU3GmPDwDUM9Aas3KjrMkueNnSCLGlMwfOnk9yTv0PHOdKj/SZSCc9byYd1o ZIREBy0PN8RkkYcqPPlTi00JHoVxft+ueq8IN5PJ7QYwQloy+69gI8Z5MO3yF7A1K0F9 gZHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from :arc-authentication-results; bh=Vq7hi0kio8eGuNgdDTJaipaWoRkgqwGZJsvdqHv8UiU=; b=iTJ/U3cuKymozPLMwaSU1azeAr+xhCc+/s74qHEOTAXprgpROLHYSrud2YiXFctAfP LnVEcPBZINLqAqX2aGcfQYmJ7HiS7NJCQMM8h9iPdzt6HSkjoEmLqMJXOAqeiv+1FkRN hgSY4ojIRCiEZC+N3X4iUlMazCxnz4J6My/9SFVc+E/GAvbyoFLDWhKQDPL6pvJwy08Q 9+jeAieeaMoLcGVJIjKOuntPMudy0QR6wx9KRZsZ+OjDfZTOIVQw3J6ZMHCtKXMCvK+Q tVYhkTsohhB4tvjv4sWvbZk4qokhpptasxdwMn5nxjHo9r3oKYGuCZPIXevKsxib/oXm 8rVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@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.google.com with ESMTPS id t16-v6si7269075qvk.10.2018.09.04.12.24.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Sep 2018 12:24:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1fxGtq-0005Qy-VH; Tue, 04 Sep 2018 19:22:06 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1fxGtp-0005Qf-8a for xen-devel@lists.xenproject.org; Tue, 04 Sep 2018 19:22:05 +0000 X-Inumbo-ID: 93f2b1c4-b077-11e8-a8a5-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 93f2b1c4-b077-11e8-a8a5-bc764e045a96; Tue, 04 Sep 2018 21:20:26 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7C35715BE; Tue, 4 Sep 2018 12:22:04 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.emea.arm.com [10.4.12.35]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4AB4D3F575; Tue, 4 Sep 2018 12:22:03 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 4 Sep 2018 20:21:53 +0100 Message-Id: <20180904192153.17210-4-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180904192153.17210-1-julien.grall@arm.com> References: <20180904192153.17210-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 3/3] xen/arm: vgic-v3-its: Make vgic_v3_its_free_domain idempotent 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: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org, shameerali.kolothum.thodi@huawei.com, Andrew Cooper MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" vgic_v3_its_free_domain may be called before vgic_v3_its_init_domain if the vGIC was failing to initalize itself. This means the list would be unitialized and result in a crash. Thankfully, we only allow ITS for the hardware domain. So the crash is not a security issue. Fix it by checking whether the list the NULL. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- Cc: Andrew Cooper --- xen/arch/arm/vgic-v3-its.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c index 32061c6b03..9edd97c4e7 100644 --- a/xen/arch/arm/vgic-v3-its.c +++ b/xen/arch/arm/vgic-v3-its.c @@ -1548,6 +1548,10 @@ void vgic_v3_its_free_domain(struct domain *d) { struct virt_its *pos, *temp; + /* Cope with unitialized vITS */ + if ( list_head_is_null(&d->arch.vgic.vits_list) ) + return; + list_for_each_entry_safe( pos, temp, &d->arch.vgic.vits_list, vits_list ) { list_del(&pos->vits_list);