diff mbox

[intel-sgx-kernel-dev,FIX,1/3] fixup - intel_sgx: pin the backing page inside sgx_eldu

Message ID 1484949673-8605-2-git-send-email-sean.j.christopherson@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sean Christopherson Jan. 20, 2017, 10:01 p.m. UTC
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 drivers/platform/x86/intel_sgx_vma.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Jarkko Sakkinen Jan. 21, 2017, 8:30 p.m. UTC | #1
On Fri, Jan 20, 2017 at 02:01:11PM -0800, Sean Christopherson wrote:
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
>  drivers/platform/x86/intel_sgx_vma.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/platform/x86/intel_sgx_vma.c b/drivers/platform/x86/intel_sgx_vma.c
> index c0fb28f..7e53c4a 100644
> --- a/drivers/platform/x86/intel_sgx_vma.c
> +++ b/drivers/platform/x86/intel_sgx_vma.c
> @@ -254,20 +254,19 @@ static struct sgx_encl_page *sgx_vma_do_fault(struct vm_area_struct *vma,
>  		secs_epc_page = NULL;
>  	}
>  
> +	rc = sgx_eldu(encl, entry, epc_page, false /* is_secs */);
>  	if (rc) {
>  		entry = ERR_PTR(rc);
>  		goto out;
>  	}
> +	free_flags = 0;
>  
> -	rc = sgx_eldu(encl, entry, epc_page, false /* is_secs */);
> +	rc = vm_insert_pfn(vma, entry->addr, PFN_DOWN(epc_page->pa));
>  	if (rc) {
> -		free_flags = 0;
>  		entry = ERR_PTR(rc);
>  		goto out;
>  	}
>  
> -	rc = vm_insert_pfn(vma, entry->addr, PFN_DOWN(epc_page->pa));
> -
>  	encl->secs_child_cnt++;
>  
>  	entry->epc_page = epc_page;
> -- 
> 2.7.4

Thanks. This must have slipped when I rebased the RFC patches on a
merge conflict.

/Jarkko
diff mbox

Patch

diff --git a/drivers/platform/x86/intel_sgx_vma.c b/drivers/platform/x86/intel_sgx_vma.c
index c0fb28f..7e53c4a 100644
--- a/drivers/platform/x86/intel_sgx_vma.c
+++ b/drivers/platform/x86/intel_sgx_vma.c
@@ -254,20 +254,19 @@  static struct sgx_encl_page *sgx_vma_do_fault(struct vm_area_struct *vma,
 		secs_epc_page = NULL;
 	}
 
+	rc = sgx_eldu(encl, entry, epc_page, false /* is_secs */);
 	if (rc) {
 		entry = ERR_PTR(rc);
 		goto out;
 	}
+	free_flags = 0;
 
-	rc = sgx_eldu(encl, entry, epc_page, false /* is_secs */);
+	rc = vm_insert_pfn(vma, entry->addr, PFN_DOWN(epc_page->pa));
 	if (rc) {
-		free_flags = 0;
 		entry = ERR_PTR(rc);
 		goto out;
 	}
 
-	rc = vm_insert_pfn(vma, entry->addr, PFN_DOWN(epc_page->pa));
-
 	encl->secs_child_cnt++;
 
 	entry->epc_page = epc_page;