• Alexey Kardashevskiy's avatar
    KVM: PPC: Book3S: Improve KVM reference counting · 716cb116
    Alexey Kardashevskiy authored
    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 potentially fragile against future changes.
    
    This references the KVM object before creating a file.
    Signed-off-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
    Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
    716cb116
book3s_64_vio.c 17.1 KB