summaryrefslogtreecommitdiffstats
path: root/drivers/firewire/ohci.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2012-06-04 21:28:07 +0200
committerStefan Richter <stefanr@s5r6.in-berlin.de>2012-06-05 00:57:37 +0200
commit7baab9acfb25934a32541d617cbc676abd1fbf5b (patch)
treede78b151877babafbec27b4ae9289673d633a518 /drivers/firewire/ohci.c
parentfirewire: ohci: lazy bus time initialization (diff)
downloadlinux-7baab9acfb25934a32541d617cbc676abd1fbf5b.tar.xz
linux-7baab9acfb25934a32541d617cbc676abd1fbf5b.zip
firewire: ohci: sanity-check MMIO resource
pci_request_region() does not fail on resources that have not been allocated by the BIOS or by the kernel, so to avoid accessing registers that are not there, we have to check for this explicitly. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/ohci.c')
-rw-r--r--drivers/firewire/ohci.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index 1c365b827815..922cd26b25e3 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -3545,6 +3545,13 @@ static int __devinit pci_probe(struct pci_dev *dev,
INIT_WORK(&ohci->bus_reset_work, bus_reset_work);
+ if (!(pci_resource_flags(dev, 0) & IORESOURCE_MEM) ||
+ pci_resource_len(dev, 0) < OHCI1394_REGISTER_SIZE) {
+ dev_err(&dev->dev, "invalid MMIO resource\n");
+ err = -ENXIO;
+ goto fail_disable;
+ }
+
err = pci_request_region(dev, 0, ohci_driver_name);
if (err) {
dev_err(&dev->dev, "MMIO resource unavailable\n");