]> xenbits.xensource.com Git - qemu-xen-4.4-testing.git/commit
qemu-traditional/passthrough: adjust MSI-X device cleanup (bug 1809)
authorJan Beulich <JBeulich@suse.com>
Mon, 2 Apr 2012 16:35:36 +0000 (17:35 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 2 Apr 2012 16:35:36 +0000 (17:35 +0100)
commit29996060f617f9a363559fb8ae6bce590c45180e
tree4aa992ba1f11e92329910c752e25d520681e1ec6
parent2503d4d5a29e7af8dffd1e11229e11c1917d2ccf
qemu-traditional/passthrough: adjust MSI-X device cleanup (bug 1809)

To address http://bugzilla.xen.org/bugzilla/show_bug.cgi?id=1809,
pt_unregister_regions() also needs to use the newly introduced
_pt_iomem_helper() instead of calling xc_domain_memory_mapping()
directly, to take into consideration the hole created for the MSI-X
table.

For this to work, two calls in unregister_real_device() need to be
swapped, since otherwise we'd have

unregister_real_device()
  -> pt_config_delete()
    -> pt_msix_delete() (frees [and fails to clear] ->msix)
  -> pt_unregister_regions()
    -> _pt_iomem_helper() (with the patch below)
      -> has_msix_mapping() (uses ->msix)

And to be certain to prevent (catch) further/future use-after-free
instances, let's also clear dev->msix in pt_msix_delete().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Yongjie Ren <yongjie.ren@intel.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
hw/pass-through.c
hw/pt-msi.c