From patchwork Thu Sep 12 19:47:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Sakkinen X-Patchwork-Id: 11143719 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA871924 for ; Thu, 12 Sep 2019 19:48:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B3C7120856 for ; Thu, 12 Sep 2019 19:48:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726981AbfILTsq (ORCPT ); Thu, 12 Sep 2019 15:48:46 -0400 Received: from mga11.intel.com ([192.55.52.93]:21360 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726851AbfILTsq (ORCPT ); Thu, 12 Sep 2019 15:48:46 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Sep 2019 12:48:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,489,1559545200"; d="scan'208";a="336683105" Received: from dscaswel-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.53.44]) by orsmga004.jf.intel.com with ESMTP; 12 Sep 2019 12:48:41 -0700 From: Jarkko Sakkinen To: linux-sgx@vger.kernel.org Cc: sean.j.christopherson@intel.com, serge.ayoun@intel.com, shay.katz-zamir@intel.com, Jarkko Sakkinen Subject: [PATCH RESEND 11/11] x86/sgx: Call sgx_encl_destroy() when the EWB flow fails Date: Thu, 12 Sep 2019 20:47:20 +0100 Message-Id: <20190912194720.7107-12-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190912194720.7107-1-jarkko.sakkinen@linux.intel.com> References: <20190912194720.7107-1-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Sender: linux-sgx-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sgx@vger.kernel.org There is not much we can do if the EWB flow fails. It can fail if the binding of the backing storage fails or if the enclave is running inside a VM and the host is suspended. Signed-off-by: Jarkko Sakkinen --- arch/x86/kernel/cpu/sgx/reclaim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/sgx/reclaim.c b/arch/x86/kernel/cpu/sgx/reclaim.c index fb41141a28a7..ba1260a373ce 100644 --- a/arch/x86/kernel/cpu/sgx/reclaim.c +++ b/arch/x86/kernel/cpu/sgx/reclaim.c @@ -345,7 +345,7 @@ static void sgx_encl_ewb(struct sgx_epc_page *epc_page, if (encls_failed(ret) || encls_returned_code(ret)) ENCLS_WARN(ret, "EWB"); - sgx_free_va_slot(va_page, va_offset); + sgx_encl_destroy(encl); } else { encl_page->desc |= va_offset; encl_page->va_page = va_page;