|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v1] xen/domain: fix memory leak in domain_create()
From: Denis Mukhin <dmukhin@xxxxxxxx>
Fix potential memory leak in domain_create() in late hardware domain case.
Fixes: b959f3b820f5 ("xen: introduce hardware domain create flag")
Signed-off-by: Denis Mukhin <dmukhin@xxxxxxxx>
---
I think that no memory allocation is required before performing late hwdom
checks (ID range and hwdom existance).
Looks like sanitise_domain_config() could better fit for performing such
configuration checks.
Alternatively, hardware_domid range could be checked via custom parser
instead of code in domain_create() and then hwdom existance can be moved
before alloc_domain_struct().
Thoughts?
---
xen/common/domain.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 2f6b0af50dd3..5ad1ac872798 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -825,7 +825,10 @@ struct domain *domain_create(domid_t domid,
/* late_hwdom is only allowed for dom0. */
if ( hardware_domain && hardware_domain->domain_id )
+ {
+ free_domain_struct(d);
return ERR_PTR(-EINVAL);
+ }
old_hwdom = hardware_domain;
hardware_domain = d;
--
2.34.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |