]> git.baikalelectronics.ru Git - kernel.git/commit
[SCSI] hpsa: fix NULL dereference in hpsa_put_ctlr_into_performant_mode()
authorscameron@beardog.cce.hp.com <scameron@beardog.cce.hp.com>
Mon, 14 Apr 2014 19:01:09 +0000 (14:01 -0500)
committerJames Bottomley <JBottomley@Parallels.com>
Mon, 21 Apr 2014 14:56:53 +0000 (07:56 -0700)
commit2d25e6245a7147734fe5f3d9c044dd6f80d9abc8
tree09ae42238805bdbc9f7f555187c40cfccb561685
parent03a169e57a9a3fd69c1713c317a06f163ad63b5c
[SCSI] hpsa: fix NULL dereference in hpsa_put_ctlr_into_performant_mode()

Initialize local variable trans_support before it is used rather
than after.  It is supposed to contain the value of a register on the
controller containing bits that describe which transport modes the
controller supports (e.g. "performant", "ioaccel1",  "ioaccel2").  A
NULL pointer dereference will almost certainly occur if trans_support
is not initialized at the right point.  If for example the uninitialized
trans_support value does not have the bit set for ioaccel2 support when it
should be, then ioaccel2_alloc_cmds_and_bft() will not get called as it
should be and the h->ioaccel2_blockFetchTable array will remain NULL
instead of being allocated.  Too late, trans_support finally gets
initialized with the correct value with ioaccel2 mode bit set,
which later causes calc_bucket_map() to be called to fill in
h->ioaccel2_blockFetchTable[].  However h->ioaccel2_blockFetchTable
is NULL because it didn't get allocated because earlier trans_support
wasn't initialized at the right point.

Fixes: 77e345bf7f9aafb080924b756244a936f98f317f
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reported-by: Baoquan He <bhe@redhat.com>
Tested-by: Baoquan He <bhe@redhat.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/hpsa.c