Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] mptsas: Fix oops for insmod during kexec

This fix's 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. 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.

Signed-off-by: Judith Lebzelter <judith@osdl.org>
Acked-by: "Moore, Eric" <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>

authored by

Judith Lebzelter and committed by
James Bottomley
ba76ef24 5daa49ef

+5 -2
+5 -2
drivers/message/fusion/mptsas.c
··· 815 815 static int 816 816 mptsas_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) 817 817 { 818 - MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)ioc->sh->hostdata; 818 + MPT_SCSI_HOST *hd; 819 819 struct mptsas_target_reset_event *target_reset_list, *n; 820 820 int rc; 821 821 ··· 827 827 if (reset_phase != MPT_IOC_POST_RESET) 828 828 goto out; 829 829 830 - if (!hd || !hd->ioc) 830 + if (!ioc->sh || !ioc->sh->hostdata) 831 + goto out; 832 + hd = (MPT_SCSI_HOST *)ioc->sh->hostdata; 833 + if (!hd->ioc) 831 834 goto out; 832 835 833 836 if (list_empty(&hd->target_reset_list))