From cb330fea471494b68d2402fe61778415f835c351 Mon Sep 17 00:00:00 2001 From: Peng Yang Date: Sat, 18 Jun 2022 23:06:13 +0800 Subject: [PATCH] gunyah: secure_vm_loader: Fix the hyp inject instruction/data abort When gh_reclaim_mem fail, we shouldn't release the CMA memory. If release the memory, primary VM will access the memory and hyp think the memory should be used by second VM. It will cause hyp inject instruction/data abort to primary VM. Change-Id: Ie16283d4009d84f94e3681cb04285f357bbd8916 Signed-off-by: Peng Yang --- drivers/virt/gunyah/gh_secure_vm_loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/virt/gunyah/gh_secure_vm_loader.c b/drivers/virt/gunyah/gh_secure_vm_loader.c index 701e1207ba8c..c7626a4bbbe3 100644 --- a/drivers/virt/gunyah/gh_secure_vm_loader.c +++ b/drivers/virt/gunyah/gh_secure_vm_loader.c @@ -343,7 +343,7 @@ int gh_secure_vm_loader_reclaim_fw(struct gh_vm *vm) ret = gh_reclaim_mem(vm, sec_vm_dev->fw_phys, sec_vm_dev->fw_size, sec_vm_dev->system_vm); - if (!sec_vm_dev->is_static) { + if (!ret && !sec_vm_dev->is_static) { dma_free_coherent(dev, sec_vm_dev->fw_size, sec_vm_dev->fw_virt, phys_to_dma(dev, sec_vm_dev->fw_phys)); }