[PATCH kernel] KVM: PPC: Improve KVM reference counting
Paul Mackerras
paulus at ozlabs.org
Fri Feb 22 20:41:53 AEDT 2019
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 <aik at ozlabs.ru>
Thanks, applied to my kvm-ppc-next tree.
Paul.
More information about the Linuxppc-dev
mailing list