ide: fix kmalloc_node breakage in ide driver
PATCH 1/1 ide: fix kmalloc_node breakage in ide driver
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.
drivers/ide/ide-probe.c +13 -3
@@ -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;
Quoted 7 lines · Ravikiran G Thirumalai
Machines with ide-interfaces which do not have pci devices are crashing on boot at
pcibus_to_nodein 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 addedBUG_ON(hwif == NULL). Please include.
This needs to go into 2.6.13.