[RESEND,11/11] x86/sgx: Call sgx_encl_destroy() when the EWB flow fails
diff mbox series

Message ID 20190912194720.7107-12-jarkko.sakkinen@linux.intel.com
State New
Headers show
  • v23 updates
Related show

Commit Message

Jarkko Sakkinen Sept. 12, 2019, 7:47 p.m. UTC
There is not much we can do if the EWB flow fails. It can fail if the
binding of the backing storage fails or if the enclave is running inside
a VM and the host is suspended.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
 arch/x86/kernel/cpu/sgx/reclaim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff mbox series

diff --git a/arch/x86/kernel/cpu/sgx/reclaim.c b/arch/x86/kernel/cpu/sgx/reclaim.c
index fb41141a28a7..ba1260a373ce 100644
--- a/arch/x86/kernel/cpu/sgx/reclaim.c
+++ b/arch/x86/kernel/cpu/sgx/reclaim.c
@@ -345,7 +345,7 @@  static void sgx_encl_ewb(struct sgx_epc_page *epc_page,
 		if (encls_failed(ret) || encls_returned_code(ret))
 			ENCLS_WARN(ret, "EWB");
-		sgx_free_va_slot(va_page, va_offset);
+		sgx_encl_destroy(encl);
 	} else {
 		encl_page->desc |= va_offset;
 		encl_page->va_page = va_page;