]> Git Repo - linux.git/commitdiff
x86/sgx: Add missing xa_destroy() when virtual EPC is destroyed
authorKai Huang <[email protected]>
Tue, 15 Jun 2021 10:16:39 +0000 (22:16 +1200)
committerBorislav Petkov <[email protected]>
Tue, 15 Jun 2021 16:03:45 +0000 (18:03 +0200)
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]
arch/x86/kernel/cpu/sgx/virt.c

index 6ad165a5c0cc57abbaf7e73fc9dfc5b42dd2c766..64511c4a52001c574bbd76cb4174d51fc1364ba3 100644 (file)
@@ -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;
This page took 0.0641 seconds and 4 git commands to generate.