[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen stable-4.5] x86/MSI: disallow redundant enabling
commit 5659aa5d833a361d0f5275c549b53be375f1271a Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Thu Oct 12 15:58:00 2017 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Thu Oct 12 15:58:00 2017 +0200 x86/MSI: disallow redundant enabling At the moment, Xen attempts to allow redundant enabling of MSI by having pci_enable_msi() return 0, and point to the existing MSI descriptor, when the msi already exists. Unfortunately, if subsequent errors are encountered, the cleanup paths assume pci_enable_msi() had done full initialization, and hence undo everything that was assumed to be done by that function without also undoing other setup that would normally occur only after that function was called (in map_domain_pirq() itself). Rather than try to make the redundant enabling case work properly, just forbid it entirely by having pci_enable_msi() return -EEXIST when MSI is already set up. This is part of XSA-237. Reported-by: HW42 <hw42@xxxxxxxxx> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: George Dunlap <george.dunlap@xxxxxxxxxx> master commit: a46126fec20e0cf4f5442352ef45efaea8c89646 master date: 2017-10-12 14:36:58 +0200 --- xen/arch/x86/msi.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c index 255e859..1b2176c 100644 --- a/xen/arch/x86/msi.c +++ b/xen/arch/x86/msi.c @@ -886,12 +886,10 @@ static int __pci_enable_msi(struct msi_info *msi, struct msi_desc **desc) old_desc = find_msi_entry(pdev, msi->irq, PCI_CAP_ID_MSI); if ( old_desc ) { - dprintk(XENLOG_WARNING, "irq %d has already mapped to MSI on " - "device %04x:%02x:%02x.%01x\n", - msi->irq, msi->seg, msi->bus, - PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn)); - *desc = old_desc; - return 0; + printk(XENLOG_ERR "irq %d already mapped to MSI on %04x:%02x:%02x.%u\n", + msi->irq, msi->seg, msi->bus, + PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn)); + return -EEXIST; } old_desc = find_msi_entry(pdev, -1, PCI_CAP_ID_MSIX); @@ -956,12 +954,10 @@ static int __pci_enable_msix(struct msi_info *msi, struct msi_desc **desc) old_desc = find_msi_entry(pdev, msi->irq, PCI_CAP_ID_MSIX); if ( old_desc ) { - dprintk(XENLOG_WARNING, "irq %d has already mapped to MSIX on " - "device %04x:%02x:%02x.%01x\n", - msi->irq, msi->seg, msi->bus, - PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn)); - *desc = old_desc; - return 0; + printk(XENLOG_ERR "irq %d already mapped to MSI-X on %04x:%02x:%02x.%u\n", + msi->irq, msi->seg, msi->bus, + PCI_SLOT(msi->devfn), PCI_FUNC(msi->devfn)); + return -EEXIST; } old_desc = find_msi_entry(pdev, -1, PCI_CAP_ID_MSI); -- generated by git-patchbot for /home/xen/git/xen.git#stable-4.5 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |