diff mbox

[intel-sgx-kernel-dev,v8,03/10] intel_sgx: fix null pointer deref in sgx_invalidate()

Message ID 20161208123828.21834-4-jarkko.sakkinen@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jarkko Sakkinen Dec. 8, 2016, 12:38 p.m. UTC
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
 drivers/platform/x86/intel_sgx_util.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Sean Christopherson Dec. 13, 2016, 7:04 p.m. UTC | #1
On Thu, 2016-12-08 at 14:38 +0200, Jarkko Sakkinen wrote:
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>
Tested-by: Sean Christopherson <sean.j.christopherson@intel.com>

> ---
>  drivers/platform/x86/intel_sgx_util.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/platform/x86/intel_sgx_util.c b/drivers/platform/x86/intel_sgx_util.c
> index d1c4c71..3878d9a 100644
> --- a/drivers/platform/x86/intel_sgx_util.c
> +++ b/drivers/platform/x86/intel_sgx_util.c
> @@ -173,6 +173,8 @@ void sgx_invalidate(struct sgx_encl *encl)
>  		vma = sgx_find_vma(encl, addr);
>  		if (vma)
>  			sgx_zap_tcs_ptes(encl, vma);
> +		else
> +			break;
>  	}
>  
>  	encl->vma_cnt = 0;
diff mbox

Patch

diff --git a/drivers/platform/x86/intel_sgx_util.c b/drivers/platform/x86/intel_sgx_util.c
index d1c4c71..3878d9a 100644
--- a/drivers/platform/x86/intel_sgx_util.c
+++ b/drivers/platform/x86/intel_sgx_util.c
@@ -173,6 +173,8 @@  void sgx_invalidate(struct sgx_encl *encl)
 		vma = sgx_find_vma(encl, addr);
 		if (vma)
 			sgx_zap_tcs_ptes(encl, vma);
+		else
+			break;
 	}
 
 	encl->vma_cnt = 0;