All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>,
	Sean Christopherson <seanjc@google.com>
Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org
Subject: Re: [PATCH kernel] KVM: Don't null dereference ops->destroy
Date: Tue, 31 May 2022 19:13:56 +0200	[thread overview]
Message-ID: <5b1b686e-d54c-014d-b93d-dc4b26a454c6@redhat.com> (raw)
In-Reply-To: <24c22c5c-2656-d590-2ae2-adfe0d3fd113@ozlabs.ru>

On 5/31/22 06:32, Alexey Kardashevskiy wrote:
>> -        ops->destroy(dev); 
>> +        if (ops->destroy)
>> +            ops->destroy(dev);
> 
> 
> btw why is destroy() not under the kvm->lock here? The comment in 
> kvm_destroy_devices() suggests that it is an exception there but not 
> necessarily here. Thanks,

The comment refers to walking the list.  The ops->destroy contract is 
that it's called outside kvm->lock, and that's followed in both places 
(both before and after the suggested patch).

Paolo


WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>,
	Sean Christopherson <seanjc@google.com>
Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org
Subject: Re: [PATCH kernel] KVM: Don't null dereference ops->destroy
Date: Tue, 31 May 2022 17:13:56 +0000	[thread overview]
Message-ID: <5b1b686e-d54c-014d-b93d-dc4b26a454c6@redhat.com> (raw)
In-Reply-To: <24c22c5c-2656-d590-2ae2-adfe0d3fd113@ozlabs.ru>

On 5/31/22 06:32, Alexey Kardashevskiy wrote:
>> -        ops->destroy(dev); 
>> +        if (ops->destroy)
>> +            ops->destroy(dev);
> 
> 
> btw why is destroy() not under the kvm->lock here? The comment in 
> kvm_destroy_devices() suggests that it is an exception there but not 
> necessarily here. Thanks,

The comment refers to walking the list.  The ops->destroy contract is 
that it's called outside kvm->lock, and that's followed in both places 
(both before and after the suggested patch).

Paolo

  reply	other threads:[~2022-05-31 17:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-24  5:52 [PATCH kernel] KVM: Don't null dereference ops->destroy Alexey Kardashevskiy
2022-05-24  5:52 ` Alexey Kardashevskiy
2022-05-24 20:01 ` Sean Christopherson
2022-05-25  1:52   ` Alexey Kardashevskiy
2022-05-25  1:52     ` Alexey Kardashevskiy
2022-05-25  2:58     ` Alexey Kardashevskiy
2022-05-25  2:58       ` Alexey Kardashevskiy
2022-05-25  7:47       ` Paolo Bonzini
2022-05-25  7:47         ` Paolo Bonzini
2022-05-31  4:32         ` Alexey Kardashevskiy
2022-05-31  4:32           ` Alexey Kardashevskiy
2022-05-31 17:13           ` Paolo Bonzini [this message]
2022-05-31 17:13             ` 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=5b1b686e-d54c-014d-b93d-dc4b26a454c6@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=aik@ozlabs.ru \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=seanjc@google.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.