All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: linux-sgx@vger.kernel.org
Subject: [PATCH for_v25 1/4] x86/sgx: Put SECS backing iff retrieving the backing succeeds
Date: Fri, 20 Dec 2019 16:31:53 -0800	[thread overview]
Message-ID: <20191221003156.27236-2-sean.j.christopherson@intel.com> (raw)
In-Reply-To: <20191221003156.27236-1-sean.j.christopherson@intel.com>

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@intel.com>
---
 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


  reply	other threads:[~2019-12-21  0:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-21  0:31 [PATCH for_v25 0/4] x86/sgx: Reclaim bug fix and cleanup Sean Christopherson
2019-12-21  0:31 ` Sean Christopherson [this message]
2019-12-21  0:31 ` [PATCH for_v25 2/4] x86/sgx: Use goto to handle sgx_encl_get_backing() failure in SECS flows Sean Christopherson
2019-12-21  0:31 ` [PATCH for_v25 3/4] x86/sgx: Drop unused @encl parameter from __sgx_encl_ewb() Sean Christopherson
2019-12-21  0:31 ` [PATCH for_v25 4/4] x86/sgx: Pre-calculate VA slot virtual address in sgx_encl_ewb() Sean Christopherson
2020-01-02 17:06 ` [PATCH for_v25 0/4] x86/sgx: Reclaim bug fix and cleanup Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191221003156.27236-2-sean.j.christopherson@intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=linux-sgx@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.