On 3/15/22 16:43, Murilo Opsfelder Araújo wrote:
+ if (!try_module_get(kvm_chardev_ops.owner)) {
+ r = -ENODEV;
+ goto out_err;
+ }
+
Doesn't this problem also affects the other functions called from
kvm_dev_ioctl()?
Is it possible that the module is removed while other ioctl's are
still running, e.g. KVM_GET_API_VERSION and KVM_CHECK_EXTENSION, even
though they don't use struct kvm?
No, because opening /dev/kvm also adds a reference to the module. The
problem is that create_vm creates another source of references to the
module that can survive after /dev/kvm is closed.
Paolo