On 6/17/19 3:24 PM, Sean Christopherson wrote: > +static int sgx_encl_mm_add(struct sgx_encl *encl, struct mm_struct *mm) > +{ > + struct sgx_encl_mm *encl_mm; > + > + encl_mm = kzalloc(sizeof(*encl_mm), GFP_KERNEL); > + if (!encl_mm) > + return -ENOMEM; > + > + encl_mm->encl = encl; > + encl_mm->mm = mm; > + kref_init(&encl_mm->refcount); > + > + spin_lock(&encl->mm_lock); > + list_add(&encl_mm->list, &encl->mm_list); > + spin_unlock(&encl->mm_lock); > + > + return 0; > +} This probably need commenting and/or changelogging about the mm refcounting or lack thereof.