]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
s390/pci: fix out of bounds access during irq setup
authorSebastian Ott <sebott@linux.ibm.com>
Wed, 5 Sep 2018 10:15:00 +0000 (12:15 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 5 Sep 2018 12:59:59 +0000 (14:59 +0200)
BugLink: https://bugs.launchpad.net/bugs/1790480
During interrupt setup we allocate interrupt vectors, walk the list of msi
descriptors, and fill in the message data. Requesting more interrupts than
supported on s390 can lead to an out of bounds access.

When we restrict the number of interrupts we should also stop walking the
msi list after all supported interrupts are handled.

Cc: stable@vger.kernel.org
Signed-off-by: Sebastian Ott <sebott@linux.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
(cherry picked from commit 866f3576a72b2233a76dffb80290f8086dc49e17)
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Acked-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
arch/s390/pci/pci.c

index 4902fed221c0effa59ff21fedabdda152641d112..8a505cfdd9b98615b792c478b6ed9cf69c5beaf3 100644 (file)
@@ -421,6 +421,8 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
        hwirq = 0;
        for_each_pci_msi_entry(msi, pdev) {
                rc = -EIO;
+               if (hwirq >= msi_vecs)
+                       break;
                irq = irq_alloc_desc(0);        /* Alloc irq on node 0 */
                if (irq < 0)
                        return -ENOMEM;