Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Ravikiran G Thirumalai <kiran@scalex86.org>
To: Andrew Morton <akpm@osdl.org>
Cc: christoph@lameter.com, shai@scalex86.org,
	linux-kernel@vger.kernel.org, ak@suse.de,
	linux-ide@vger.kernel.org,
	Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [patch] ide: fix kmalloc_node breakage in ide driver
Date: Wed, 3 Aug 2005 18:26:57 -0700	[thread overview]
Message-ID: <20050804012657.GA3542@localhost.localdomain> (raw)

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;
 

             reply	other threads:[~2005-08-04  1:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-04  1:26 Ravikiran G Thirumalai [this message]
2005-08-04  1:31 ` [patch] ide: fix kmalloc_node breakage in ide driver Christoph Lameter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050804012657.GA3542@localhost.localdomain \
    --to=kiran@scalex86.org \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=bzolnier@gmail.com \
    --cc=christoph@lameter.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shai@scalex86.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox