Re: [PATCH] KVM: allow struct kvm to outlive the file descriptors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/2/22 18:47, Sean Christopherson wrote:
+	/* This is safe, since we have a reference from open(). */
+	__module_get(THIS_MODULE);
This isn't sufficient.  For x86, it only grabs a reference to kvm.ko, not the
vendor module.  Instead, we can do:

	if (!try_module_get(kvm_chardev_ops.owner))
		return ERR_PTR(-EINVAL);

And then on top, revert commit revert ("KVM: set owner of cpu and vm file operations").
vCPUs file descriptors hold reference to the VM, which means they indirectly hold a
reference to the module. So once the "real" bug of struct kvm not holding a reference
to the module is fixed, grabbing a reference when a VM/vCPU inode is opened becomes
unnecessary.


Got it, I'll wait for David to post the right thing. :)

Paolo




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux