]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[SCSI] mptspi: fix oops in mptspi_dv_renegotiate_work()
authorJames Bottomley <James.Bottomley@HansenPartnership.com>
Mon, 7 Jul 2008 16:24:06 +0000 (11:24 -0500)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Tue, 8 Jul 2008 14:40:04 +0000 (09:40 -0500)
The problem here is that if the ioc faults too early in the bring up
sequence (as it usually does for an irq routing problem), ioc_reset gets
called before the scsi host is even allocated.  This causes an oops when
it later schedules a renegotiation.  Fix this by checking ioc->sh before
trying to renegotiate.

Cc: "Moore, Eric" <Eric.Moore@lsi.com>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/message/fusion/mptspi.c

index 25bcfcf36f2e365bbdebf0afc06b261ab2be8a36..1effca4e40e119d28f5ae3b9ed681f60eaa026f0 100644 (file)
@@ -1266,13 +1266,18 @@ mptspi_dv_renegotiate(struct _MPT_SCSI_HOST *hd)
 static int
 mptspi_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
 {
-       struct _MPT_SCSI_HOST *hd = shost_priv(ioc->sh);
        int rc;
 
        rc = mptscsih_ioc_reset(ioc, reset_phase);
 
-       if (reset_phase == MPT_IOC_POST_RESET)
+       /* only try to do a renegotiation if we're properly set up
+        * if we get an ioc fault on bringup, ioc->sh will be NULL */
+       if (reset_phase == MPT_IOC_POST_RESET &&
+           ioc->sh) {
+               struct _MPT_SCSI_HOST *hd = shost_priv(ioc->sh);
+
                mptspi_dv_renegotiate(hd);
+       }
 
        return rc;
 }