[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[for-4.18][PATCH] xen/arm: Check return code from recursive calls to scan_pfdt_node()


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Mon, 16 Oct 2023 14:45:59 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WiCrYxdKyFBWS67/6ZzkitTMejEeK2oP06ZKxoPdFHc=; b=lAvtUReoTlAK4tktAf/yvrhe6uMfsfeouv5HMjIurYyo9UbOSUCj4Ju7E6a9ZJW/5N7FFJrsKJl2PPzXdNjGi0a0DzRAiLABj9rSZgr54bUDqwwm0I9QdqZGdfajoeUVYZdsUoQjCBgYqpnyPKOUIyHyIK87BCxLDPppQcHNxtqEbLChESwE6HtQhaSeDLpYIYvWxOZzfEK9ac2++qXFCR6de6xYmaBNGzp5h4yjCGQltcmZX7jSNpHQDPM4Hko60fIlr3K1IyymJJRAWSBG/UNcvB2GL4XR2kSXA1sb0gvw0DdaqcU/5tfr2kP6VWn47lVBlZO/kEul7NtautEj/g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DCBb7gAn8unjsJKXgdHiM0H/bJ3XrfQuT6lEXQqlBw+CKrmP5XvliYBMVwGcb6OoK26pcj8PKNzNCIl0gHpAUUKLdhMbGdF+wq5LCru5Y8nysC5B1brGKIQqFfbF2LaLBQaJ8MX+72zEHI330GZJJ4fYHECgoYxkHrjur5PBbU80X3Rc16FZbY1p3WOlnwhvGc9YuBEzPXtR5NyIUJ+OvhhIvV7Ru+u4fAkFbIBJjVxgAWYcPKWB4HANY9J8/dq/DZpsGiaIC2UlFU86eC5TRko7R43WhAFxQtAnFQ35Gb24eu4ut9RvRaDuC1sxAUjJDXX9f7ddMo2Wodw84EXVVA==
  • Cc: Michal Orzel <michal.orzel@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, <Henry.Wang@xxxxxxx>
  • Delivery-date: Mon, 16 Oct 2023 12:46:22 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

At the moment, we do not check a return code from scan_pfdt_node()
called recursively. This means that any issue that may occur while
parsing and copying the passthrough nodes is hidden and Xen continues
to boot a domain despite errors. This may lead to incorrect device tree
generation and various guest issues (e.g. trap on attempt to access MMIO
not mapped in P2M). Fix it.

Fixes: 669ecdf8d6cd ("xen/arm: copy dtb fragment to guest dtb")
Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
---
@Henry:
This is a bug fix, so I think we should have it in 4.18 given the possible
consequences I described in the commit msg. I don't see any risks as this change
only checks the return code for an error.
---
 xen/arch/arm/domain_build.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 24c9019cc43c..49792dd590ee 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2872,8 +2872,11 @@ static int __init scan_pfdt_node(struct kernel_info 
*kinfo, const void *pfdt,
     node_next = fdt_first_subnode(pfdt, nodeoff);
     while ( node_next > 0 )
     {
-        scan_pfdt_node(kinfo, pfdt, node_next, address_cells, size_cells,
-                       scan_passthrough_prop);
+        rc = scan_pfdt_node(kinfo, pfdt, node_next, address_cells, size_cells,
+                            scan_passthrough_prop);
+        if ( rc )
+            return rc;
+
         node_next = fdt_next_subnode(pfdt, node_next);
     }
 
-- 
2.25.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.