From 61c8bd1d3a9e7e57843d98d9b133fec77ecf4e1b Mon Sep 17 00:00:00 2001
authorvlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Wed, 14 Oct 2009 16:29:08 +0000 (16:29 +0000)
committervlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Wed, 14 Oct 2009 16:29:08 +0000 (16:29 +0000)
commitd4cea7d2c3e471039c7f196a7c167dbf0c5a8ecb
tree3a979efc19e0e4fe5f19e061fd6cacddfb017176
parent16e2b4d977bb50e9ddd3fe016723ed279873096d
From 61c8bd1d3a9e7e57843d98d9b133fec77ecf4e1b Mon Sep 17 00:00:00 2001
From: Andrew Vasquez <andrew.vasquez@qlogic.com>
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 <joy@entuzijast.net>
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Submitted by Gal Rosen <galr@storwize.com>

git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@1213 d57e44dd-8a1f-0410-8b47-8ef2f437770f
qla2x00t/qla_isr.c
qla2x00t/qla_os.c