From: David Hildenbrand <david@redhat.com>
To: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
rkrcmar@redhat.com, Dmitry Vyukov <dvyukov@google.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
stable@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1] KVM: kvm_io_bus_unregister_dev() should never fail
Date: Thu, 23 Mar 2017 17:20:48 +0100 [thread overview]
Message-ID: <48d409b3-d584-eaa3-24ca-e7330d6fc0e1@redhat.com> (raw)
In-Reply-To: <20170323170635.1fb91a2c.cornelia.huck@de.ibm.com>
> As this may set kvm->buses[bus_idx] to NULL, don't you also need to
> guard for bus == NULL in kvm_io_bus_destroy()? (I looked at the code on
> kvm/queue.)
very right, so something like this?
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index e1be4b4..ef1aa7f 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -728,7 +728,8 @@ static void kvm_destroy_vm(struct kvm *kvm)
spin_unlock(&kvm_lock);
kvm_free_irq_routing(kvm);
for (i = 0; i < KVM_NR_BUSES; i++) {
- kvm_io_bus_destroy(kvm->buses[i]);
+ if (kvm->buses[i])
+ kvm_io_bus_destroy(kvm->buses[i]);
kvm->buses[i] = NULL;
}
kvm_coalesced_mmio_free(kvm);
Thanks!
>
>> synchronize_srcu_expedited(&kvm->srcu);
>> kfree(bus);
>> - return r;
>> + return;
>> }
>
--
Thanks,
David
next prev parent reply other threads:[~2017-03-23 16:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-23 14:34 [PATCH v1] KVM: kvm_io_bus_unregister_dev() should never fail David Hildenbrand
2017-03-23 16:06 ` Cornelia Huck
2017-03-23 16:20 ` David Hildenbrand [this message]
2017-03-23 16:40 ` Cornelia Huck
2017-03-23 17:15 ` David Hildenbrand
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=48d409b3-d584-eaa3-24ca-e7330d6fc0e1@redhat.com \
--to=david@redhat.com \
--cc=cornelia.huck@de.ibm.com \
--cc=dvyukov@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.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