[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a0eee64e-763a-0db3-29d1-e19ee80ba1ee@redhat.com>
Date: Wed, 2 Mar 2022 18:48:16 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
dmatlack@...gle.com
Subject: Re: [PATCH] KVM: allow struct kvm to outlive the file descriptors
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
Powered by blists - more mailing lists