[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210616003634.320206-1-kai.huang@intel.com>
Date: Wed, 16 Jun 2021 12:36:34 +1200
From: Kai Huang <kai.huang@...el.com>
To: linux-sgx@...r.kernel.org, x86@...nel.org
Cc: linux-kernel@...r.kernel.org, bp@...en8.de, seanjc@...gle.com,
jarkko@...nel.org, dave.hansen@...el.com, tglx@...utronix.de,
mingo@...hat.com, Yang Zhong <yang.zhong@...el.com>,
Kai Huang <kai.huang@...el.com>
Subject: [PATCH v2] x86/sgx: Add missing xa_destroy() when virtual EPC is destroyed
xa_destroy() needs to be called to destroy virtual EPC's page array
before calling kfree() to free the virtual EPC. Currently it is not
called. Add the missing xa_destroy() to fix.
Fixes: 540745ddbc70 ("x86/sgx: Introduce virtual EPC for use by KVM guests")
Tested-by: Yang Zhong <yang.zhong@...el.com>
Acked-by: Dave Hansen <dave.hansen@...el.com>
Signed-off-by: Kai Huang <kai.huang@...el.com>
---
v1->v2:
- Fixed typo in commit msg
- Added Dave's Acked-by
---
arch/x86/kernel/cpu/sgx/virt.c | 1 +
1 file changed, 1 insertion(+)
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;
--
2.31.1
Powered by blists - more mailing lists