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 <quic_penyan@quicinc.com>
This commit is contained in:
Peng Yang 2022-06-18 23:06:13 +08:00
parent 51372d1749
commit cb330fea47

View File

@ -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));
}