From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fabiano Rosas Date: Tue, 25 Jan 2022 15:08:33 +0000 Subject: Re: [PATCH v2 4/4] KVM: PPC: Decrement module refcount if init_vm fails Message-Id: <87mtjjx37y.fsf@linux.ibm.com> List-Id: References: <20220124220803.1011673-1-farosas@linux.ibm.com> <20220124220803.1011673-5-farosas@linux.ibm.com> <1643082153.tb99kluqtm.astroid@bobo.none> In-Reply-To: <1643082153.tb99kluqtm.astroid@bobo.none> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Nicholas Piggin , kvm-ppc@vger.kernel.org Cc: aik@ozlabs.ru, linuxppc-dev@lists.ozlabs.org Nicholas Piggin writes: > Excerpts from Fabiano Rosas's message of January 25, 2022 8:08 am: >> We increment the reference count for KVM-HV/PR before the call to >> kvmppc_core_init_vm. If that function fails we need to decrement the >> refcount. >> >> Signed-off-by: Fabiano Rosas >> --- >> Caught this while testing Nick's LPID patches by looking at >> /sys/module/kvm_hv/refcnt > > Nice catch. Is this the only change in the series? Yes. > You can just use kvm_ops->owner like try_module_get() does I think? Also > try_module_get works on a NULL module same as module_put by the looks, > so you could adjust that in this patch to remove the NULL check so it > is consistent with the put. Sure, I'll send a v3.