Blob Blame History Raw
From: David Matlack <dmatlack@google.com>
Date: Thu, 3 Mar 2022 18:33:28 +0000
Subject: Revert "KVM: set owner of cpu and vm file operations"
Git-commit: 70375c2d8fa3fb9b0b59207a9c5df1e2e1205c10
Patch-mainline: v5.18-rc1
References: git-fixes

This reverts commit 3d3aab1b973b01bd2a1aa46307e94a1380b1d802.

Now that the KVM module's lifetime is tied to kvm.users_count, there is
no need to also tie it's lifetime to the lifetime of the VM and vCPU
file descriptors.

Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: David Matlack <dmatlack@google.com>
Message-Id: <20220303183328.1499189-3-dmatlack@google.com>
Reviewed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Ivan T. Ivanov <iivanov@suse.de>
---
 virt/kvm/kvm_main.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -3483,7 +3483,7 @@ static int kvm_vcpu_release(struct inode
 	return 0;
 }
 
-static struct file_operations kvm_vcpu_fops = {
+static const struct file_operations kvm_vcpu_fops = {
 	.release        = kvm_vcpu_release,
 	.unlocked_ioctl = kvm_vcpu_ioctl,
 	.mmap           = kvm_vcpu_mmap,
@@ -4532,7 +4532,7 @@ static long kvm_vm_compat_ioctl(struct f
 }
 #endif
 
-static struct file_operations kvm_vm_fops = {
+static const struct file_operations kvm_vm_fops = {
 	.release        = kvm_vm_release,
 	.unlocked_ioctl = kvm_vm_ioctl,
 	.llseek		= noop_llseek,
@@ -5489,8 +5489,6 @@ int kvm_init(void *opaque, unsigned vcpu
 		goto out_free;
 
 	kvm_chardev_ops.owner = module;
-	kvm_vm_fops.owner = module;
-	kvm_vcpu_fops.owner = module;
 
 	r = misc_register(&kvm_dev);
 	if (r) {