From 384319da1808ec56e119b4eb9c6a8b37fe493395 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Wed, 14 Oct 2009 16:29:08 +0000 Subject: [PATCH] From 61c8bd1d3a9e7e57843d98d9b133fec77ecf4e1b Mon Sep 17 00:00:00 2001 From: Andrew Vasquez Date: Mon, 29 Sep 2008 15:15:04 +0000 Subject: SCSI: qla2xxx: Defer enablement of RISC interrupts until ISP initialization completes. commit 048feec5548c0582ee96148c61b87cccbcb5f9be upstream Josip Rodin noted (http://article.gmane.org/gmane.linux.ports.sparc/10152) the driver oopsing during registration of an rport to the FC-transport layer with a backtrace indicating a dereferencing of an shost->shost_data equal to NULL. David Miller identified a small window in driver logic where this could happen: > Look at how the driver registers the IRQ handler before the host has > been registered with the SCSI layer. > > That leads to a window of time where the shost hasn't been setup > fully, yet ISRs can come in and trigger DPC thread events, such as > loop resyncs, which expect the transport area to be setup. > > But it won't be setup, because scsi_add_host() hasn't finished yet. > > Note that in Josip's crash log, we don't even see the > > qla_printk(KERN_INFO, ha, "\n" > " QLogic Fibre Channel HBA Driver: %s\n" > " QLogic %s - %s\n" > " ISP%04X: %s @ %s hdma%c, host#=%ld, fw=%s\n", > ... > > message yet. > > Which means that the crash occurs between qla2x00_request_irqs() > and printing that message. Close this window by enabling RISC interrupts after the host has been registered with the SCSI midlayer. Reported-by: Josip Rodin Signed-off-by: Andrew Vasquez Signed-off-by: James Bottomley Signed-off-by: Greg Kroah-Hartman Submitted by Gal Rosen git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1213 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t/qla_isr.c | 1 - qla2x00t/qla_os.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/qla2x00t/qla_isr.c b/qla2x00t/qla_isr.c index ca7df4c35..660d79c51 100644 --- a/qla2x00t/qla_isr.c +++ b/qla2x00t/qla_isr.c @@ -2092,7 +2092,6 @@ clear_risc_ints: WRT_REG_WORD(®->isp.hccr, HCCR_CLR_HOST_INT); } spin_unlock_irq(&ha->hardware_lock); - ha->isp_ops->enable_intrs(ha); fail: return ret; diff --git a/qla2x00t/qla_os.c b/qla2x00t/qla_os.c index 537e5e8da..849b4968a 100644 --- a/qla2x00t/qla_os.c +++ b/qla2x00t/qla_os.c @@ -1776,6 +1776,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) if (ret) goto probe_failed; + ha->isp_ops->enable_intrs(ha); + scsi_scan_host(host); qla2x00_alloc_sysfs_attr(ha);