linux-sgx.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kai Huang <kai.huang@intel.com>
To: Jarkko Sakkinen <jarkko@kernel.org>
Cc: linux-sgx@vger.kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org, bp@alien8.de, seanjc@google.com,
	dave.hansen@intel.com, tglx@linutronix.de, mingo@redhat.com,
	Yang Zhong <yang.zhong@intel.com>
Subject: Re: [PATCH v2] x86/sgx: Add missing xa_destroy() when virtual EPC is destroyed
Date: Fri, 25 Jun 2021 13:45:35 +1200	[thread overview]
Message-ID: <925090f035b8e749ea7aca8c857690c8afba7349.camel@intel.com> (raw)
In-Reply-To: <20210623132844.heleuoxogrpz3cpm@kernel.org>

On Wed, 2021-06-23 at 16:28 +0300, Jarkko Sakkinen wrote:
> On Wed, Jun 16, 2021 at 12:36:34PM +1200, Kai Huang wrote:
> > xa_destroy() needs to be called to destroy virtual EPC's page array
> > before calling kfree() to free the virtual EPC.  Currently it is not
> > called.  Add the missing xa_destroy() to fix.
> > 
> > Fixes: 540745ddbc70 ("x86/sgx: Introduce virtual EPC for use by KVM guests")
> > Tested-by: Yang Zhong <yang.zhong@intel.com>
> > Acked-by: Dave Hansen <dave.hansen@intel.com>
> > Signed-off-by: Kai Huang <kai.huang@intel.com>
> 
> 
> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

Thanks Jarkko.

Hi Boris,

Should we consider to get this into 5.13, since it is a fix?

> 
> > ---
> > v1->v2:
> > 
> >  - Fixed typo in commit msg
> >  - Added Dave's Acked-by
> > ---
> >  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 6ad165a5c0cc..64511c4a5200 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;
> > -- 
> > 2.31.1
> > 
> > 
> 
> /Jarkko



  reply	other threads:[~2021-06-25  1:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-16  0:36 [PATCH v2] x86/sgx: Add missing xa_destroy() when virtual EPC is destroyed Kai Huang
2021-06-23 13:28 ` Jarkko Sakkinen
2021-06-25  1:45   ` Kai Huang [this message]
2021-06-25  8:22     ` Borislav Petkov
2021-06-25 12:04       ` Kai Huang
2021-06-25 13:47         ` Borislav Petkov
2021-06-25 23:06           ` Kai Huang

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=925090f035b8e749ea7aca8c857690c8afba7349.camel@intel.com \
    --to=kai.huang@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=jarkko@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sgx@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --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).