linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.6.24-rc3] aec62xx: Fix kernel oops in driver's probe function
@ 2007-11-17 21:43 Aleksandar Radovanovic
  2007-11-18 21:43 ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 2+ messages in thread
From: Aleksandar Radovanovic @ 2007-11-17 21:43 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: Linus Torvalds, linux-ide

From: Aleksandar Radovanovic <biblbroks@sezampro.yu>

Add pci_enable_device() to aec62xx probe function
before doing any I/O.

Original probe function tries to read from device's
PCI region 4 before calling ide_setup_pci_device().
Since the device is not enabled at this point,
on machines that have no firmware PCI initialization
(e.g. ASUS WL-700gE router), corresponding PCI BAR 
is 0 and the following inb() causes a kernel oops.

Signed-off-by: Aleksandar Radovanovic <biblbroks@sezampro.yu>

---

 aec62xx.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

The patch has been tested and merged
in the trunk of the OpenWrt distribution
(on 2.6.23.1).

Anyway, should be a fairly obvious fix.

diff -Npur linux-2.6.24-rc3.orig/drivers/ide/pci/aec62xx.c linux-2.6.24-rc3/drivers/ide/pci/aec62xx.c
--- linux-2.6.24-rc3.orig/drivers/ide/pci/aec62xx.c	2007-11-17 21:33:59.000000000 +0100
+++ linux-2.6.24-rc3/drivers/ide/pci/aec62xx.c	2007-11-17 20:55:12.000000000 +0100
@@ -260,6 +260,11 @@ static int __devinit aec62xx_init_one(st
 {
 	struct ide_port_info d;
 	u8 idx = id->driver_data;
+	int err;
+
+	err = pci_enable_device(dev);
+	if (err)
+		return err;

 	d = aec62xx_chipsets[idx];

@@ -272,7 +277,11 @@ static int __devinit aec62xx_init_one(st
 		}
 	}

-	return ide_setup_pci_device(dev, &d);
+	err = ide_setup_pci_device(dev, &d);
+	if (err)
+		pci_disable_device(dev);
+
+	return err;
 }

 static const struct pci_device_id aec62xx_pci_tbl[] = {



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-11-18 21:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-17 21:43 [PATCH 2.6.24-rc3] aec62xx: Fix kernel oops in driver's probe function Aleksandar Radovanovic
2007-11-18 21:43 ` Bartlomiej Zolnierkiewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).