Re: [PATCH v2] KVM: kvm_io_bus_unregister_dev() should never fail

2017-03-24 Thread Cornelia Huck
On Fri, 24 Mar 2017 07:33:01 -0300 Marcelo Tosatti wrote: > Still dislike the "unregister all bus devices" as that renders the guest > unuseable. Can't you fail gracefully? Say force qemu error. The callers are probably too varied to find a common way to do that (multiply with different user spa

Re: [PATCH v2] KVM: kvm_io_bus_unregister_dev() should never fail

2017-03-24 Thread Marcelo Tosatti
On Fri, Mar 24, 2017 at 09:48:31AM +0100, Dmitry Vyukov wrote: > On Thu, Mar 23, 2017 at 9:42 PM, Marcelo Tosatti wrote: > > On Thu, Mar 23, 2017 at 06:24:19PM +0100, David Hildenbrand wrote: > >> No caller currently checks the return value of > >> kvm_io_bus_unregister_dev(). This is evil, as all

Re: [PATCH v2] KVM: kvm_io_bus_unregister_dev() should never fail

2017-03-24 Thread Cornelia Huck
On Fri, 24 Mar 2017 09:55:15 +0100 David Hildenbrand wrote: > > >>> - return r; > >>> + if (i == bus->dev_count) > >>> + return; > >>> > >>> new_bus = kmalloc(sizeof(*bus) + ((bus->dev_count - 1) * > >>> sizeof(struct kvm_io_range)), GFP_

Re: [PATCH v2] KVM: kvm_io_bus_unregister_dev() should never fail

2017-03-24 Thread David Hildenbrand
>>> - return r; >>> + if (i == bus->dev_count) >>> + return; >>> >>> new_bus = kmalloc(sizeof(*bus) + ((bus->dev_count - 1) * >>> sizeof(struct kvm_io_range)), GFP_KERNEL); >>> - if (!new_bus) >>> - return -ENOMEM; >>> +

Re: [PATCH v2] KVM: kvm_io_bus_unregister_dev() should never fail

2017-03-24 Thread Dmitry Vyukov
On Thu, Mar 23, 2017 at 9:42 PM, Marcelo Tosatti wrote: > On Thu, Mar 23, 2017 at 06:24:19PM +0100, David Hildenbrand wrote: >> No caller currently checks the return value of >> kvm_io_bus_unregister_dev(). This is evil, as all callers silently go on >> freeing their device. A stale reference will

Re: [PATCH v2] KVM: kvm_io_bus_unregister_dev() should never fail

2017-03-23 Thread Marcelo Tosatti
On Thu, Mar 23, 2017 at 06:24:19PM +0100, David Hildenbrand wrote: > No caller currently checks the return value of > kvm_io_bus_unregister_dev(). This is evil, as all callers silently go on > freeing their device. A stale reference will remain in the io_bus, > getting at least used again, when the

Re: [PATCH v2] KVM: kvm_io_bus_unregister_dev() should never fail

2017-03-23 Thread Cornelia Huck
On Thu, 23 Mar 2017 18:24:19 +0100 David Hildenbrand wrote: > No caller currently checks the return value of > kvm_io_bus_unregister_dev(). This is evil, as all callers silently go on > freeing their device. A stale reference will remain in the io_bus, > getting at least used again, when the iobu

[PATCH v2] KVM: kvm_io_bus_unregister_dev() should never fail

2017-03-23 Thread David Hildenbrand
No caller currently checks the return value of kvm_io_bus_unregister_dev(). This is evil, as all callers silently go on freeing their device. A stale reference will remain in the io_bus, getting at least used again, when the iobus gets teared down on kvm_destroy_vm() - leading to use after free err