public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mptspi: fix oops in mptspi_dv_renegotiate_work()
@ 2008-07-07 16:24 James Bottomley
  0 siblings, 0 replies; only message in thread
From: James Bottomley @ 2008-07-07 16:24 UTC (permalink / raw)
  To: linux-scsi; +Cc: Moore, Eric, Satyam Sharma

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.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

---
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index 25bcfcf..5963457 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -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;
 }



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-07-07 16:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-07 16:24 [PATCH] mptspi: fix oops in mptspi_dv_renegotiate_work() James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox