]> www.infradead.org Git - users/jedix/linux-maple.git/commit
xen/pciback: Return error on XEN_PCI_OP_enable_msi when device has MSI or MSI-X enabled
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 3 Apr 2015 15:08:22 +0000 (11:08 -0400)
committerJoao Martins <joao.m.martins@oracle.com>
Sun, 27 Mar 2016 01:01:38 +0000 (02:01 +0100)
commit44c93c30386d5e45740f1d61ea95110df8aff368
tree062501124d103f85b291e087c0a449faea92bb05
parent6019a01eb20ec89326578eab3bfa3fc28fa897e8
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>
(cherry picked from commit 56441f3c8e5bd45aab10dd9f8c505dd4bec03b0d)
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
drivers/xen/xen-pciback/pciback_ops.c