]> git.karo-electronics.de Git - linux-beck.git/commit
[SCSI] mpt2sas: Fix for panic happening because of improper memory allocation
authornagalakshmi.nandigama@lsi.com <nagalakshmi.nandigama@lsi.com>
Tue, 20 Mar 2012 06:40:01 +0000 (12:10 +0530)
committerJames Bottomley <JBottomley@Parallels.com>
Mon, 23 Apr 2012 18:27:50 +0000 (19:27 +0100)
commite42fafc25fa86c61824e8d4c5e7582316415d24f
tree835e4e9d649f5853606dbdd3a2f804f83d77c8f1
parent39af7a98946a73f2e4bfb35cfbca2114366d0c82
[SCSI] mpt2sas: Fix for panic happening because of improper memory allocation

The ioc->pfacts member in the IOC structure is getting set to zero
following a call to _base_get_ioc_facts due to the memset in that routine.
So if the ioc->pfacts was read after a host reset, there would be a NULL
pointer dereference. The routine _base_get_ioc_facts is called from context
of host reset.  The problem in _base_get_ioc_facts  is the size of
Mpi2IOCFactsReply is 64, whereas the sizeof "struct mpt2sas_facts" is 60,
so there is a four byte overflow resulting from the memset.

Also, there is memset in _base_get_port_facts using the incorrect structure,
it should be "struct mpt2sas_port_facts" instead of Mpi2PortFactsReply.

Signed-off-by: Nagalakshmi Nandigama <nagalakshmi.nandigama@lsi.com>
CC: stable@vger.kernel.org
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/mpt2sas/mpt2sas_base.c