linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "tip-bot2 for Kai Huang" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Kai Huang <kai.huang@intel.com>, Borislav Petkov <bp@suse.de>,
	Dave Hansen <dave.hansen@intel.com>,
	Yang Zhong <yang.zhong@intel.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/urgent] x86/sgx: Add missing xa_destroy() when virtual EPC is destroyed
Date: Tue, 15 Jun 2021 16:16:24 -0000	[thread overview]
Message-ID: <162377378414.19906.6678244614782222506.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20210615101639.291929-1-kai.huang@intel.com>

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     4692bc775d2180a937335ccba0edce557103d44a
Gitweb:        https://git.kernel.org/tip/4692bc775d2180a937335ccba0edce557103d44a
Author:        Kai Huang <kai.huang@intel.com>
AuthorDate:    Tue, 15 Jun 2021 22:16:39 +12:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Tue, 15 Jun 2021 18:03:45 +02:00

x86/sgx: Add missing xa_destroy() when virtual EPC is destroyed

xa_destroy() needs to be called to destroy a virtual EPC's page array
before calling kfree() to free the virtual EPC. Currently it is not
called so add the missing xa_destroy().

Fixes: 540745ddbc70 ("x86/sgx: Introduce virtual EPC for use by KVM guests")
Signed-off-by: Kai Huang <kai.huang@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Dave Hansen <dave.hansen@intel.com>
Tested-by: Yang Zhong <yang.zhong@intel.com>
Link: https://lkml.kernel.org/r/20210615101639.291929-1-kai.huang@intel.com
---
 arch/x86/kernel/cpu/sgx/virt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/cpu/sgx/virt.c b/arch/x86/kernel/cpu/sgx/virt.c
index 6ad165a..64511c4 100644
--- a/arch/x86/kernel/cpu/sgx/virt.c
+++ b/arch/x86/kernel/cpu/sgx/virt.c
@@ -212,6 +212,7 @@ static int sgx_vepc_release(struct inode *inode, struct file *file)
 		list_splice_tail(&secs_pages, &zombie_secs_pages);
 	mutex_unlock(&zombie_secs_pages_lock);
 
+	xa_destroy(&vepc->page_array);
 	kfree(vepc);
 
 	return 0;

      parent reply	other threads:[~2021-06-15 16:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-15 10:16 [PATCH] x86/sgx: Add missing xa_destroy() when virtual EPC is destroyed Kai Huang
2021-06-15 13:20 ` Jarkko Sakkinen
2021-06-16  0:30   ` Kai Huang
2021-06-17 14:34     ` Borislav Petkov
2021-06-18  0:04       ` Kai Huang
2021-06-18  5:15         ` Borislav Petkov
2021-06-15 15:39 ` Dave Hansen
2021-06-16  0:28   ` Kai Huang
2021-06-15 16:16 ` tip-bot2 for Kai Huang [this message]

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=162377378414.19906.6678244614782222506.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=bp@suse.de \
    --cc=dave.hansen@intel.com \
    --cc=kai.huang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=x86@kernel.org \
    --cc=yang.zhong@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).