megaraid_sas: Fix instance access in megasas_reset_timer
commit20e801924287a2eebe00395f4cebc8eeb7d5aa62
authoradam radford <aradford@gmail.com>
Thu, 13 Oct 2011 23:01:12 +0000 (13 16:01 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 11 Nov 2011 17:35:24 +0000 (11 09:35 -0800)
tree73787d768577fabcaf0069935f243bd653a9b57b
parent95bf50db41fbb1db306b3e636d46ce9014482a50
megaraid_sas: Fix instance access in megasas_reset_timer

commit f575c5d3ebdca3b0482847d8fcba971767754a9e upstream.

The following patch for megaraid_sas will fix a potential bad pointer access
in megasas_reset_timer(), when a MegaRAID 9265/9285 or 9360/9380 gets a
timeout.  megasas_build_io_fusion() sets SCp.ptr to be a struct
megasas_cmd_fusion *, but then megasas_reset_timer() was casting SCp.ptr to be
a struct megasas_cmd *, then trying to access cmd->instance, which is invalid.

Just loading instance from scmd->device->host->hostdata in
megasas_reset_timer() fixes the issue.

Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/scsi/megaraid/megaraid_sas_base.c