[PATCH for_v25 1/4] x86/sgx: Put SECS backing iff retrieving the backing succeeds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Put the SECS backing if and only if retrieving the backing succeeded,
otherwise sgx_encl_put_backing() will consume uninitialized pointers.

Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>
---
 arch/x86/kernel/cpu/sgx/reclaim.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/sgx/reclaim.c b/arch/x86/kernel/cpu/sgx/reclaim.c
index 21fbfe2ed9c4..67bda5528625 100644
--- a/arch/x86/kernel/cpu/sgx/reclaim.c
+++ b/arch/x86/kernel/cpu/sgx/reclaim.c
@@ -361,9 +361,9 @@ static void sgx_reclaimer_write(struct sgx_epc_page *epc_page,
 
 				sgx_free_page(encl->secs.epc_page);
 				encl->secs.epc_page = NULL;
+
+				sgx_encl_put_backing(&secs_backing, true);
 			}
-
-			sgx_encl_put_backing(&secs_backing, true);
 		}
 	}
 
-- 
2.24.1




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux