public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: muriloo@linux.ibm.com, David Matlack <dmatlack@google.com>
Cc: kvm@vger.kernel.org, Marcelo Tosatti <mtosatti@redhat.com>,
	Gleb Natapov <gleb@redhat.com>, Rik van Riel <riel@redhat.com>,
	seanjc@google.com, bgardon@google.com, stable@vger.kernel.org,
	farosas@linux.ibm.com
Subject: Re: [PATCH RESEND 1/2] KVM: Prevent module exit until all VMs are freed
Date: Tue, 15 Mar 2022 21:45:45 +0100	[thread overview]
Message-ID: <fc0bca25-fbda-d489-5ad9-04db49cee205@redhat.com> (raw)
In-Reply-To: <cb11c10b-0520-02ef-afb5-6f524847d67f@linux.ibm.com>


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


  reply	other threads:[~2022-03-15 20:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-03 18:33 [PATCH RESEND 0/2] KVM: Prevent module exit until all VMs are freed David Matlack
2022-03-03 18:33 ` [PATCH RESEND 1/2] " David Matlack
2022-03-08 21:40   ` Sean Christopherson
2022-03-08 22:28     ` David Matlack
2022-03-08 23:08       ` Sean Christopherson
2022-03-08 23:44         ` David Matlack
2022-03-08 23:43     ` David Matlack
2022-03-15 15:43   ` Murilo Opsfelder Araújo
2022-03-15 20:45     ` Paolo Bonzini [this message]
2022-03-03 18:33 ` [PATCH RESEND 2/2] Revert "KVM: set owner of cpu and vm file operations" David Matlack
2022-03-08 21:40   ` Sean Christopherson
2022-03-15 20:49 ` [PATCH RESEND 0/2] KVM: Prevent module exit until all VMs are freed Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fc0bca25-fbda-d489-5ad9-04db49cee205@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=bgardon@google.com \
    --cc=dmatlack@google.com \
    --cc=farosas@linux.ibm.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=muriloo@linux.ibm.com \
    --cc=riel@redhat.com \
    --cc=seanjc@google.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox