On Fri, 2025-08-08 at 10:47 +0000, Reshetova, Elena wrote:
> > 
> > > diff --git a/arch/x86/kernel/cpu/sgx/encl.c 
> > > b/arch/x86/kernel/cpu/sgx/encl.c
> > > index 308dbbae6c6e..cf149b9f4916 100644
> > > --- a/arch/x86/kernel/cpu/sgx/encl.c
> > > +++ b/arch/x86/kernel/cpu/sgx/encl.c
> > > @@ -765,6 +765,7 @@ void sgx_encl_release(struct kref *ref)
> > >           WARN_ON_ONCE(encl->secs.epc_page);
> > > 
> > >           kfree(encl);
> > > + sgx_dec_usage_count();
> > >   }
> > > 
> > > 
> > 
> > [...]
> > 
> > > --- a/arch/x86/kernel/cpu/sgx/virt.c
> > > +++ b/arch/x86/kernel/cpu/sgx/virt.c
> > > @@ -255,10 +255,11 @@ static int sgx_vepc_release(struct inode *inode,
> > struct file *file)
> > >           xa_destroy(&vepc->page_array);
> > >           kfree(vepc);
> > > 
> > > + sgx_dec_usage_count();
> > >           return 0;
> > >   }
> > 
> > Given we have __sgx_(vepc_)open(), I think it makes more sense to have
> > __sgx_(encl_|vepc_)release() counterpart?
> 
> Is it worth it? In case of *_open() variants there are quite error handling
> under different cases, but for release as you can see it is just a one-line
> addition. Not sure it is worth adding the wrappers just for that. 
> But I can change it if people think it would look better this way.

Either way is fine to me.  Feel free to ignore.

Reply via email to