From: Sepherosa Ziehau Date: Tue, 28 Aug 2012 06:02:10 +0000 (+0800) Subject: pci: Guard against wrong user supplied IRQ assignment X-Git-Tag: v3.2.0~240 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/67e880fe9aca998a993716e113fdcad808480afc pci: Guard against wrong user supplied IRQ assignment --- diff --git a/sys/bus/pci/pci.c b/sys/bus/pci/pci.c index 1fb6d954df..ad8b277983 100644 --- a/sys/bus/pci/pci.c +++ b/sys/bus/pci/pci.c @@ -2701,8 +2701,17 @@ pci_assign_interrupt(device_t bus, device_t dev, int force_route) if (irq >= 255 || irq <= 0) { irq = PCI_INVALID_IRQ; } else { - BUS_CONFIG_INTR(bus, dev, irq, - INTR_TRIGGER_LEVEL, INTR_POLARITY_LOW); + if (machintr_legacy_intr_find(irq, + INTR_TRIGGER_LEVEL, INTR_POLARITY_LOW) < 0) { + device_printf(dev, + "hw.pci%d.%d.%d.%d.INT%c.irq=%d, invalid\n", + cfg->domain, cfg->bus, cfg->slot, cfg->func, + cfg->intpin + 'A' - 1, irq); + irq = PCI_INVALID_IRQ; + } else { + BUS_CONFIG_INTR(bus, dev, irq, + INTR_TRIGGER_LEVEL, INTR_POLARITY_LOW); + } } }