From: Julien Grall Subject: [PATCH v2] libxl: Don't ignore error when we fail to give access to ioport/irq/iomem Date: Fri, 9 Jan 2015 15:56:45 +0000 Message-ID: <1420819005-6222-1-git-send-email-julien.grall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Y9bw5-0007BK-UT for xen-devel@lists.xenproject.org; Fri, 09 Jan 2015 15:57:18 +0000 Received: by mail-wi0-f171.google.com with SMTP id bs8so3148720wib.4 for ; Fri, 09 Jan 2015 07:57:16 -0800 (PST) List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Wei Liu , Julien Grall , Ian Jackson , Ian Campbell , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org If we fail to give the access, the domain will unlikely work correctly. So we should bail out at the first error. Signed-off-by: Julien Grall Cc: Ian Jackson Cc: Stefano Stabellini Cc: Ian Campbell Cc: Wei Liu --- This patch is candidate for a backport for at least Xen 4.4 and Xen 4.5. Changes in v2: - Also bail out when libxl fails to give access to iomem --- tools/libxl/libxl_create.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 1198225..6f87d1c 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1167,6 +1167,7 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, "failed give dom%d access to ioports %"PRIx32"-%"PRIx32, domid, io->first, io->first + io->number - 1); ret = ERROR_FAIL; + goto error_out; } } @@ -1182,6 +1183,7 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, if (ret < 0) { LOGE(ERROR, "failed give dom%d access to irq %d", domid, irq); ret = ERROR_FAIL; + goto error_out; } } @@ -1198,7 +1200,7 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, "failed give dom%d access to iomem range %"PRIx64"-%"PRIx64, domid, io->start, io->start + io->number - 1); ret = ERROR_FAIL; - continue; + goto error_out; } ret = xc_domain_memory_mapping(CTX->xch, domid, io->gfn, io->start, @@ -1209,6 +1211,7 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, " to guest address %"PRIx64, domid, io->start, io->start + io->number - 1, io->gfn); ret = ERROR_FAIL; + goto error_out; } } -- 2.1.4