lkml.org 
[lkml]   [2021]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2] x86/sgx: Add missing xa_destroy() when virtual EPC is destroyed
From
Date
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


\
 
 \ /
  Last update: 2021-06-25 03:46    [W:0.130 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site