mptsas: Fix oops for insmod during kexec
Subsystems (2)
PATCH 1/1 mptsas: Fix oops for insmod during kexec
Hello,
This patch is to fix an oops on insmod for mptsas during kexec. This applies to 2.6.21-rc3.
---
drivers/message/fusion/mptsas.c +5 -2
@@ -815,7 +815,7 @@ mptsas_taskmgmt_complete(MPT_ADAPTER *iostatic int mptsas_ioc_reset (MPT_ADAPTER *ioc,int reset_phase) { -MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)ioc->sh->hostdata; +MPT_SCSI_HOST *hd;struct mptsas_target_reset_event *target_reset_list, *n;int rc;
@@ -827,7 +827,10 @@ mptsas_ioc_reset(MPT_ADAPTER *ioc, int rif (reset_phase !=MPT_IOC_POST_RESET ) goto out; -if (!hd || !hd->ioc) +if (!ioc->sh || !ioc->sh->hostdata) + goto out; + hd = (MPT_SCSI_HOST *)ioc->sh->hostdata; +if (!hd->ioc) goto out;if (list_empty (&hd->target_reset_list))
Quoted 24 lines · Judith Lebzelter
Hello,
This patch is to fix an oops on insmod for mptsas during kexec. This applies to 2.6.21-rc3.
Signed-off-by Judith Lebzelter <[email protected]---
Index:
linux-2.6.21-rc3/drivers/message/fusion/mptsas.c
===================================================================drivers/message/fusion/mptsas.c +1
-1@@ -815,7 +815,7 @@ mptsas_taskmgmt_complete(MPT_ADAPTER *iostatic int mptsas_ioc_reset (MPT_ADAPTER *ioc,int reset_phase) { -MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)ioc->sh->hostdata; +MPT_SCSI_HOST *hd;struct mptsas_target_reset_event *target_reset_list, *n;int rc;
drivers/message/fusion/mptsas.c mptsas_ioc_reset(MPT_ADAPTER *ioc, int r · line 833
Quoted 8 lines
drivers/message/fusion/mptsas.c +4
-1@@ -827,7 +827,10 @@ mptsas_ioc_reset(MPT_ADAPTER *ioc, int rif (reset_phase !=MPT_IOC_POST_RESET ) goto out; -if (!hd || !hd->ioc) +if (!ioc->sh || !ioc->sh->hostdata) + goto out; + hd = (MPT_SCSI_HOST *)ioc->sh->hostdata; +if (!hd->ioc)
This needs a much better explanation. Please show the codepath leading to this.
Quoted 4 lines · Christoph Hellwig
This needs a much better explanation. Please show the codepath leading to this.
I was working with Judith on this patch earlier this week, so this is approved by LSI,,, ACK.
This fix's an oops during driver load time. mptsas_probe callsmpt_attach(over in mptbase.c). Inside that call, we read some manufacturing config pages to setup some defaults. While reading the config pages, the firmware doesn't complete the reply in time, and we have a timeout. The timeout results in hardreset handler being called. The hardreset handler calls all the fusion upper layer driver reset callback handlers. The mptsas_ioc_reset function is the callback
handler in mptsas.c. So where I'm getting to, is mptsas_ioc_reset is
getting called before scsi_host_alloc is called, and the pointer ioc->sh is NULL.,,, as well as the hostdata.
Quoted 11 lines · Eric
Quoted 4 lines · Christoph Hellwig
This needs a much better explanation. Please show the codepath leading to this.
I was working with Judith on this patch earlier this week, so this is approved by LSI,,, ACK.
Quoted 10 lines
This fix's an oops during driver load time.
mptsas_probecallsmpt_attach(over in mptbase.c). Inside that call, we read some manufacturing config pages to setup some defaults. While reading the config pages, the firmware doesn't complete the reply in time, and we have a timeout. The timeout results in hardreset handler being called. The hardreset handler calls all the fusion upper layer driver reset callback handlers. Themptsas_ioc_resetfunction is the callback
handler inmptsas.c. So where I'm getting to, ismptsas_ioc_resetis
getting called beforescsi_host_allocis called, and the pointerioc->shis NULL.,,, as well as the hostdata.
Ok. Please put a reformulated version of the above statement as a comment above the checks, so that people don't rip it out again.
PATCH 1/1 mptsas: Fix oops during driver load time(rev 2)
This fixes an oops during driver load time.
mptsas_probe calls mpt_attach(over in mptbase.c). Inside that call, we read some manufacturing config pages to setup some defaults. While reading the config pages, the firmware doesn't complete the reply in time, and we have a timeout. The timeout results in hardreset handler being called. The hardreset handler calls all the fusion upper layer driver reset callback handlers. The mptsas_ioc_reset function is the callback handler
in mptsas.c. In summary, mptsas_ioc_reset is getting called
before scsi_host_alloc is called, and the pointer ioc->sh is NULL, as well as the hostdata.
---
Sorry I was not more descriptive. Here is the patch with Eric's description as requested.
drivers/message/fusion/mptsas.c +5 -2
@@ -815,7 +815,7 @@ mptsas_taskmgmt_complete(MPT_ADAPTER *iostatic int mptsas_ioc_reset (MPT_ADAPTER *ioc,int reset_phase) { -MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)ioc->sh->hostdata; +MPT_SCSI_HOST *hd;struct mptsas_target_reset_event *target_reset_list, *n;int rc;
@@ -827,7 +827,10 @@ mptsas_ioc_reset(MPT_ADAPTER *ioc, int rif (reset_phase !=MPT_IOC_POST_RESET ) goto out; -if (!hd || !hd->ioc) +if (!ioc->sh || !ioc->sh->hostdata) + goto out; + hd = (MPT_SCSI_HOST *)ioc->sh->hostdata; +if (!hd->ioc) goto out;if (list_empty (&hd->target_reset_list))