@@ -73,7 +73,7 @@ static struct sgx_epc_page *sgx_encl_eldu(struct sgx_encl_page *encl_page,
ret = __sgx_encl_eldu(encl_page, epc_page, secs_page);
if (ret) {
- sgx_free_page(epc_page);
+ __sgx_free_page(epc_page);
return ERR_PTR(ret);
}
@@ -485,7 +485,7 @@ void sgx_encl_destroy(struct sgx_encl *encl)
}
if (!encl->secs_child_cnt && encl->secs.epc_page) {
- sgx_free_page(encl->secs.epc_page);
+ __sgx_free_page(encl->secs.epc_page);
encl->secs.epc_page = NULL;
}
@@ -498,7 +498,7 @@ void sgx_encl_destroy(struct sgx_encl *encl)
va_page = list_first_entry(&encl->va_pages, struct sgx_va_page,
list);
list_del(&va_page->list);
- sgx_free_page(va_page->epc_page);
+ __sgx_free_page(va_page->epc_page);
kfree(va_page);
}
}
@@ -696,7 +696,7 @@ struct sgx_epc_page *sgx_alloc_va_page(void)
ret = __epa(sgx_epc_addr(epc_page));
if (ret) {
WARN_ONCE(1, "EPA returned %d (0x%x)", ret, ret);
- sgx_free_page(epc_page);
+ __sgx_free_page(epc_page);
return ERR_PTR(-EFAULT);
}
@@ -47,7 +47,7 @@ static void sgx_encl_shrink(struct sgx_encl *encl, struct sgx_va_page *va_page)
encl->page_cnt--;
if (va_page) {
- sgx_free_page(va_page->epc_page);
+ __sgx_free_page(va_page->epc_page);
list_del(&va_page->list);
kfree(va_page);
}
@@ -220,7 +220,7 @@ static int sgx_encl_create(struct sgx_encl *encl, struct sgx_secs *secs)
return 0;
err_out:
- sgx_free_page(encl->secs.epc_page);
+ __sgx_free_page(encl->secs.epc_page);
encl->secs.epc_page = NULL;
err_out_backing:
@@ -448,7 +448,7 @@ static int sgx_encl_add_page(struct sgx_encl *encl,
mutex_unlock(&encl->lock);
err_out_free:
- sgx_free_page(epc_page);
+ __sgx_free_page(epc_page);
kfree(encl_page);
return ret;
@@ -323,7 +323,7 @@ static void sgx_reclaimer_write(struct sgx_epc_page *epc_page,
if (!encl->secs_child_cnt) {
if (atomic_read(&encl->flags) & SGX_ENCL_DEAD) {
- sgx_free_page(encl->secs.epc_page);
+ __sgx_free_page(encl->secs.epc_page);
encl->secs.epc_page = NULL;
} else if (atomic_read(&encl->flags) & SGX_ENCL_INITIALIZED) {
ret = sgx_encl_get_backing(encl, PFN_DOWN(encl->size),
@@ -331,7 +331,7 @@ static void sgx_reclaimer_write(struct sgx_epc_page *epc_page,
if (!ret) {
sgx_encl_ewb(encl->secs.epc_page, &secs_backing);
- sgx_free_page(encl->secs.epc_page);
+ __sgx_free_page(encl->secs.epc_page);
encl->secs.epc_page = NULL;
}
Use __sgx_free_page() in all locations where the EPC page is supposed to be unreclaimable so that a WARN fires if the page is unexpectedly marked for reclaim. Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> --- arch/x86/kernel/cpu/sgx/encl.c | 8 ++++---- arch/x86/kernel/cpu/sgx/ioctl.c | 6 +++--- arch/x86/kernel/cpu/sgx/reclaim.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-)