[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] xen/arm: Fix domain_handle_dtb_bootmodule() error path
commit 028c43902b420e202c9f71a49334bf2f5e5393bc Author: Michal Orzel <michal.orzel@xxxxxxx> AuthorDate: Tue Jul 11 10:29:30 2023 +0200 Commit: Julien Grall <jgrall@xxxxxxxxxx> CommitDate: Fri Jul 14 17:34:43 2023 +0100 xen/arm: Fix domain_handle_dtb_bootmodule() error path Fix the error path in domain_handle_dtb_bootmodule(), so that the memory previously mapped is unmapped before returning the error code. This is because the function shall not make assumptions on the way of handling its error code in the callers. Today we call panic in case of domU creation failure, so having memory not unmapped is not a bug, but it can change. Similarly, fix prepare_dtb_domU() so that the memory allocated is freed before returning the error code from domain_handle_dtb_bootmodule(). Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx> Acked-by: Julien Grall <jgrall@xxxxxxxxxx> Reviewed-by: Luca Fancellu <luca.fancellu@xxxxxxx> --- xen/arch/arm/domain_build.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index d0d6be922d..f2134f24b9 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -3204,7 +3204,7 @@ static int __init domain_handle_dtb_bootmodule(struct domain *d, res = check_partial_fdt(pfdt, kinfo->dtb_bootmodule->size); if ( res < 0 ) - return res; + goto out; for ( node_next = fdt_first_subnode(pfdt, 0); node_next > 0; @@ -3235,7 +3235,7 @@ static int __init domain_handle_dtb_bootmodule(struct domain *d, DT_ROOT_NODE_SIZE_CELLS_DEFAULT, false); if ( res ) - return res; + goto out; continue; } if ( dt_node_cmp(name, "passthrough") == 0 ) @@ -3245,11 +3245,12 @@ static int __init domain_handle_dtb_bootmodule(struct domain *d, DT_ROOT_NODE_SIZE_CELLS_DEFAULT, true); if ( res ) - return res; + goto out; continue; } } + out: iounmap(pfdt); return res; @@ -3326,7 +3327,7 @@ static int __init prepare_dtb_domU(struct domain *d, struct kernel_info *kinfo) { ret = domain_handle_dtb_bootmodule(d, kinfo); if ( ret ) - return ret; + goto err; } ret = make_gic_domU_node(kinfo); -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |