linux-stable/drivers/xen/xen-pciback
Konrad Rzeszutek Wilk 56441f3c8e xen/pciback: Return error on XEN_PCI_OP_enable_msi when device has MSI or MSI-X enabled
The guest sequence of:

 a) XEN_PCI_OP_enable_msi
 b) XEN_PCI_OP_enable_msi
 c) XEN_PCI_OP_disable_msi

results in hitting an BUG_ON condition in the msi.c code.

The MSI code uses an dev->msi_list to which it adds MSI entries.
Under the above conditions an BUG_ON() can be hit. The device
passed in the guest MUST have MSI capability.

The a) adds the entry to the dev->msi_list and sets msi_enabled.
The b) adds a second entry but adding in to SysFS fails (duplicate entry)
and deletes all of the entries from msi_list and returns (with msi_enabled
is still set).  c) pci_disable_msi passes the msi_enabled checks and hits:

BUG_ON(list_empty(dev_to_msi_list(&dev->dev)));

and blows up.

The patch adds a simple check in the XEN_PCI_OP_enable_msi to guard
against that. The check for msix_enabled is not stricly neccessary.

This is part of XSA-157.

CC: stable@vger.kernel.org
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
2015-12-18 10:48:19 -05:00
..
conf_space.c xen-pciback: Add name prefix to global 'permissive' variable 2015-04-29 17:34:50 +01:00
conf_space.h xen-pciback: Add name prefix to global 'permissive' variable 2015-04-29 17:34:50 +01:00
conf_space_capability.c xen/pciback: Drop two backends, squash and cleanup some code. 2011-07-19 20:58:35 -04:00
conf_space_header.c xen-pciback: Add name prefix to global 'permissive' variable 2015-04-29 17:34:50 +01:00
conf_space_quirks.c xen/pciback: miscellaneous adjustments 2011-09-21 18:17:59 -04:00
conf_space_quirks.h xen/pciback: Drop two backends, squash and cleanup some code. 2011-07-19 20:58:35 -04:00
Makefile xen/pciback: Have 'passthrough' option instead of XEN_PCIDEV_BACKEND_PASS and XEN_PCIDEV_BACKEND_VPCI 2011-07-19 21:04:20 -04:00
passthrough.c xen/pciback: Don't deadlock when unbinding. 2014-12-04 12:41:58 +00:00
pci_stub.c xen/pciback: Don't print scary messages when unsupported by hypervisor. 2015-03-16 14:49:14 +00:00
pciback.h xen/pciback: Save xen_pci_op commands before processing it 2015-12-18 10:00:47 -05:00
pciback_ops.c xen/pciback: Return error on XEN_PCI_OP_enable_msi when device has MSI or MSI-X enabled 2015-12-18 10:48:19 -05:00
vpci.c xen/pciback: Don't deadlock when unbinding. 2014-12-04 12:41:58 +00:00
xenbus.c xenbus_client: Extend interface to support multi-page ring 2015-04-15 10:56:47 +01:00