[PATCH] xen/domain: fix error path in domain_create()

Stewart Hildebrand posted 1 patch 4 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20231205032918.3656211-1-stewart.hildebrand@amd.com
xen/common/domain.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] xen/domain: fix error path in domain_create()
Posted by Stewart Hildebrand 4 months, 3 weeks ago
If rangeset_new() fails, err would not be set to an appropriate error
code. Set it to -ENOMEM.

Fixes: 580c458699e3 ("xen/domain: Call arch_domain_create() as early as possible in domain_create()")
Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
---
 xen/common/domain.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index cd2ca6d49a5e..c5954cdb1ac2 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -710,6 +710,7 @@ struct domain *domain_create(domid_t domid,
         watchdog_domain_init(d);
         init_status |= INIT_watchdog;
 
+        err = -ENOMEM;
         d->iomem_caps = rangeset_new(d, "I/O Memory", RANGESETF_prettyprint_hex);
         d->irq_caps   = rangeset_new(d, "Interrupts", 0);
         if ( !d->iomem_caps || !d->irq_caps )
-- 
2.43.0
Re: [PATCH] xen/domain: fix error path in domain_create()
Posted by Jan Beulich 4 months, 3 weeks ago
On 05.12.2023 04:29, Stewart Hildebrand wrote:
> If rangeset_new() fails, err would not be set to an appropriate error
> code. Set it to -ENOMEM.
> 
> Fixes: 580c458699e3 ("xen/domain: Call arch_domain_create() as early as possible in domain_create()")
> Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>