From: Vikas Chaudhary Date: Thu, 20 Sep 2012 11:35:08 +0000 (-0400) Subject: [SCSI] qla4xxx: Fix panic while rmmod X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=f8b0751de6a963016be0bd404fa063d96ed4ba92;p=linux-beck.git [SCSI] qla4xxx: Fix panic while rmmod Issue: System panic on rmmod if probe_adapter had failed during driver load. Call Trace: [] qla4xxx_abort_active_cmds+0x4a/0xa0 [qla4xxx] [] qla4xxx_free_adapter+0x1b/0x1b0 [qla4xxx] [] qla4xxx_remove_adapter+0x294/0x2c7 [qla4xxx] [] pci_device_remove+0x37/0x70 [] __device_release_driver+0x6f/0xe0 [] driver_detach+0xc8/0xd0 [] bus_remove_driver+0x8e/0x110 [] driver_unregister+0x62/0xa0 [] pci_unregister_driver+0x44/0xb0 [] qla4xxx_module_exit+0x15/0x47 [qla4xxx] [] sys_delete_module+0x194/0x260 [] ? do_page_fault+0x3e/0xa0 [] system_call_fastpath+0x16/0x1b Fix: Do not cleanup resources on remove_adapter as they are cleaned up during probe_adapter exit. Signed-off-by: Vikas Chaudhary Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 29bd2258ab6f..97ce44bb1ce9 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -5449,6 +5449,13 @@ static void __devexit qla4xxx_remove_adapter(struct pci_dev *pdev) { struct scsi_qla_host *ha; + /* + * If the PCI device is disabled then it means probe_adapter had + * failed and resources already cleaned up on probe_adapter exit. + */ + if (!pci_is_enabled(pdev)) + return; + ha = pci_get_drvdata(pdev); if (is_qla40XX(ha))