]> git.karo-electronics.de Git - karo-tx-linux.git/commit
megaraid_sas: Fix instance access in megasas_reset_timer
authoradam radford <aradford@gmail.com>
Thu, 13 Oct 2011 23:01:12 +0000 (16:01 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 11 Nov 2011 17:42:30 +0000 (09:42 -0800)
commit50311c8ba6d62ef6e35ffdc3081a83ce7087bf15
tree1366db7b01b5b2464cda16a4e02f571979828562
parentd0dab5614492504dffb2b99c6ba88e77393a3d06
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