linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] ide: fix kmalloc_node breakage in ide driver
@ 2005-08-04  1:26 Ravikiran G Thirumalai
  2005-08-04  1:31 ` Christoph Lameter
  0 siblings, 1 reply; 2+ messages in thread
From: Ravikiran G Thirumalai @ 2005-08-04  1:26 UTC (permalink / raw)
  To: Andrew Morton
  Cc: christoph, shai, linux-kernel, ak, linux-ide,
	Bartlomiej Zolnierkiewicz

Machines with ide-interfaces which do not have pci devices are crashing on boot
at pcibus_to_node in the ide drivers.  We noticed this on a x445 running
2.6.13-rc4.  Similar issue was discussed earlier, but the crash was due 
to hwif being NULL.
http://marc.theaimsgroup.com/?t=112075352000003&r=1&w=2
Andi and Christoph had patches, but neither went in.  Here's one of those
patches with an added BUG_ON(hwif == NULL).  Please include.

Thanks,
Kiran


Patch fixes oops caused by ide interfaces not on pci. pcibus_to_node causes
the kernel to crash otherwise.  Patch also adds a BUG_ON to check if hwif is 
NULL. 

Signed-off-by: Christoph Lameter <christoph@lameter.com>
Signed-off-by: Shai Fultheim <shai@scalex86.org>
Signed-off-by: Ravikiran Thirumalai <kiran@scalex86.org>


Index: linux-2.6.13-rc1/drivers/ide/ide-probe.c
===================================================================
--- linux-2.6.13-rc1.orig/drivers/ide/ide-probe.c	2005-06-29 20:06:53.000000000 -0400
+++ linux-2.6.13-rc1/drivers/ide/ide-probe.c	2005-08-02 10:09:20.930965408 -0400
@@ -960,6 +960,15 @@
 }
 #endif /* MAX_HWIFS > 1 */
 
+static inline int hwif_to_node(ide_hwif_t *hwif)
+{
+	if (hwif->pci_dev)
+		return pcibus_to_node(hwif->pci_dev->bus);
+	else
+		/* Add ways to determine the node of other busses here */
+		return -1;
+}
+
 /*
  * init request queue
  */
@@ -978,8 +987,7 @@
 	 *	do not.
 	 */
 
-	q = blk_init_queue_node(do_ide_request, &ide_lock,
-				pcibus_to_node(drive->hwif->pci_dev->bus));
+	q = blk_init_queue_node(do_ide_request, &ide_lock, hwif_to_node(hwif));
 	if (!q)
 		return 1;
 
@@ -1048,6 +1056,8 @@
 
 	BUG_ON(in_interrupt());
 	BUG_ON(irqs_disabled());	
+	BUG_ON(hwif == NULL);
+	
 	down(&ide_cfg_sem);
 	hwif->hwgroup = NULL;
 #if MAX_HWIFS > 1
@@ -1097,7 +1107,7 @@
 		spin_unlock_irq(&ide_lock);
 	} else {
 		hwgroup = kmalloc_node(sizeof(ide_hwgroup_t), GFP_KERNEL,
-			pcibus_to_node(hwif->drives[0].hwif->pci_dev->bus));
+					hwif_to_node(hwif->drives[0].hwif));
 		if (!hwgroup)
 	       		goto out_up;
 

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

* Re: [patch] ide: fix kmalloc_node breakage in ide driver
  2005-08-04  1:26 [patch] ide: fix kmalloc_node breakage in ide driver Ravikiran G Thirumalai
@ 2005-08-04  1:31 ` Christoph Lameter
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Lameter @ 2005-08-04  1:31 UTC (permalink / raw)
  To: Ravikiran G Thirumalai
  Cc: Andrew Morton, shai, linux-kernel, ak, linux-ide,
	Bartlomiej Zolnierkiewicz

On Wed, 3 Aug 2005, Ravikiran G Thirumalai wrote:

> Machines with ide-interfaces which do not have pci devices are crashing on boot
> at pcibus_to_node in the ide drivers.  We noticed this on a x445 running
> 2.6.13-rc4.  Similar issue was discussed earlier, but the crash was due 
> to hwif being NULL.
> http://marc.theaimsgroup.com/?t=112075352000003&r=1&w=2
> Andi and Christoph had patches, but neither went in.  Here's one of those
> patches with an added BUG_ON(hwif == NULL).  Please include.

This needs to go into 2.6.13.


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

end of thread, other threads:[~2005-08-04  1:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-04  1:26 [patch] ide: fix kmalloc_node breakage in ide driver Ravikiran G Thirumalai
2005-08-04  1:31 ` Christoph Lameter

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).