From patchwork Sun Dec 8 02:32:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 22141 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 498A823FD2 for ; Sun, 8 Dec 2013 02:32:40 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id i4sf8880807oah.2 for ; Sat, 07 Dec 2013 18:32:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=zr6ZjbGkq0R1dJZfUUsPPZGT9L31kGHzqi76YQoMj2o=; b=fBfxOqcDoDNtbSvpiS901z6FHGKeOEA+8/cD+DVGWwFluV9cCXIFrg9T9g/iN+AOaO uP8R6ZPuqD3QvGHGjDlNX4cIBWdrPEmjaV4gJXEZfqmH5yim/2t81wP/LfKZQ2AKgO5J dKlk3k94QC+AHaOBufZR7nO6OCElX3YzbYKKZLux8NX4/cSz0/nh9PXDGZEjwu/ArPOU fCsTONTyVf1d+9MjhIGuI9hwTJcMS7Wmy6t5NgwU96PZbFEc/VdFsFNbD7Lnfv+1QL+M m0KUv6S1rdQKTK11cKGRYT8morIrpBXPAtRd1MRtyQQkL0iRdJ/h73Ajmc2OhyERv0Cp l9IA== X-Gm-Message-State: ALoCoQm291pgnoWlbXR0NUpYOtZFdnKaQIYz7jeV13Sn59OE454VeEahnJjiBR3ctpnIMwpaVqgg X-Received: by 10.182.81.7 with SMTP id v7mr4079865obx.28.1386469960191; Sat, 07 Dec 2013 18:32:40 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.48.129 with SMTP id l1ls1635514qen.75.gmail; Sat, 07 Dec 2013 18:32:40 -0800 (PST) X-Received: by 10.52.98.194 with SMTP id ek2mr5942851vdb.11.1386469960063; Sat, 07 Dec 2013 18:32:40 -0800 (PST) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id a6si1564700vdp.104.2013.12.07.18.32.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 07 Dec 2013 18:32:40 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id pa12so2435966veb.33 for ; Sat, 07 Dec 2013 18:32:39 -0800 (PST) X-Received: by 10.220.132.208 with SMTP id c16mr7132vct.55.1386469959942; Sat, 07 Dec 2013 18:32:39 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp18399vcz; Sat, 7 Dec 2013 18:32:39 -0800 (PST) X-Received: by 10.15.52.73 with SMTP id o49mr7924396eew.60.1386469958938; Sat, 07 Dec 2013 18:32:38 -0800 (PST) Received: from mail-ea0-f182.google.com (mail-ea0-f182.google.com [209.85.215.182]) by mx.google.com with ESMTPS id m49si3954202eeg.199.2013.12.07.18.32.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 07 Dec 2013 18:32:38 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.182 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.215.182; Received: by mail-ea0-f182.google.com with SMTP id a15so945817eae.13 for ; Sat, 07 Dec 2013 18:32:38 -0800 (PST) X-Received: by 10.14.113.199 with SMTP id a47mr7968252eeh.41.1386469958021; Sat, 07 Dec 2013 18:32:38 -0800 (PST) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id a51sm12468166eeh.8.2013.12.07.18.32.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Dec 2013 18:32:37 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Cc: patches@linaro.org, ian.campbell@citrix.com, tim@xen.org, stefano.stabellini@citrix.com, Julien Grall Subject: [PATCH] xen/arm: arch_domain_create: don't return 0 when alloc_xenheap_pages has failed Date: Sun, 8 Dec 2013 02:32:32 +0000 Message-Id: <1386469952-21744-1-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The previous call before alloc_xenheap_pages reset rc to 0 if it success. If the latter fails, arch_domain_create will return 0 and Xen will consider the domain as valid. Move rc initialization later. Signed-off-by: Julien Grall Acked-by: Stefano Stabellini --- xen/arch/arm/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 52d2403..67c65c3 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -501,10 +501,10 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags) if ( is_idle_domain(d) ) return 0; - rc = -ENOMEM; if ( (rc = p2m_init(d)) != 0 ) goto fail; + rc = -ENOMEM; if ( (d->shared_info = alloc_xenheap_pages(0, 0)) == NULL ) goto fail;