aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Huang <[email protected]>2021-06-15 22:16:39 +1200
committerBorislav Petkov <[email protected]>2021-06-15 18:03:45 +0200
commit4692bc775d2180a937335ccba0edce557103d44a (patch)
tree64da667e5326aa89e5a8b382cdcd484cc9ce8d4e
parentefa165504943f2128d50f63de0c02faf6dcceb0d (diff)
x86/sgx: Add missing xa_destroy() when virtual EPC is destroyed
xa_destroy() needs to be called to destroy a virtual EPC's page array before calling kfree() to free the virtual EPC. Currently it is not called so add the missing xa_destroy(). Fixes: 540745ddbc70 ("x86/sgx: Introduce virtual EPC for use by KVM guests") Signed-off-by: Kai Huang <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Acked-by: Dave Hansen <[email protected]> Tested-by: Yang Zhong <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
-rw-r--r--arch/x86/kernel/cpu/sgx/virt.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/sgx/virt.c b/arch/x86/kernel/cpu/sgx/virt.c
index 6ad165a5c0cc..64511c4a5200 100644
--- a/arch/x86/kernel/cpu/sgx/virt.c
+++ b/arch/x86/kernel/cpu/sgx/virt.c
@@ -212,6 +212,7 @@ static int sgx_vepc_release(struct inode *inode, struct file *file)
list_splice_tail(&secs_pages, &zombie_secs_pages);
mutex_unlock(&zombie_secs_pages_lock);
+ xa_destroy(&vepc->page_array);
kfree(vepc);
return 0;