From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Mackerras Date: Fri, 22 Feb 2019 09:41:53 +0000 Subject: Re: [PATCH kernel] KVM: PPC: Improve KVM reference counting Message-Id: <20190222094153.GF6006@blackberry> List-Id: References: <20190221034414.41777-1-aik@ozlabs.ru> In-Reply-To: <20190221034414.41777-1-aik@ozlabs.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Alexey Kardashevskiy Cc: linuxppc-dev@lists.ozlabs.org, kvm-ppc@vger.kernel.org, David Gibson On Thu, Feb 21, 2019 at 02:44:14PM +1100, Alexey Kardashevskiy wrote: > The anon fd's ops releases the KVM reference in the release hook. > However we reference the KVM object after we create the fd so there is > small window when the release function can be called and > dereferenced the KVM object which potentially may free it. > > It is not a problem at the moment as the file is created and KVM is > referenced under the KVM lock and the release function obtains the same > lock before dereferencing the KVM (although the lock is not held when > calling kvm_put_kvm()) but it is a fragile against future changes. > > This references the KVM object before creating a file. > > Signed-off-by: Alexey Kardashevskiy Thanks, applied to my kvm-ppc-next tree. Paul.