Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > fc11cd6e1c513a17304da94a5390f3cd > files > 3521

kernel-2.6.18-194.11.1.el5.src.rpm

From: Tomas Henzl <thenzl@redhat.com>
Date: Fri, 26 Feb 2010 12:55:01 -0500
Subject: [scsi] mpt2sas: fix missing initialization
Message-id: <4B87C4A5.7050408@redhat.com>
Patchwork-id: 23449
O-Subject: Re: [RHEL5.5 PATCH V2] mpt2sas: fix missing initialization
Bugzilla: 565637
RH-Acked-by: Rob Evers <revers@redhat.com>
RH-Acked-by: David Milburn <dmilburn@redhat.com>

This is for bz#565637

The mpt2sas driver is facing some issues
in certain configurations with sata disks attached
via an expansion backplane.
The patch from LSI adds some missing initialization,
it resolves the customers issue.
The first hunk comes from LSI and was tested by the customer.
I've added some resource allocation checking
and the whole path was again acked by Kashyap(LSI).

Brew build http://brewweb.devel.redhat.com/brew/taskinfo?taskID=2280101

Tomas

Signed-off-by: Jarod Wilson <jarod@redhat.com>

diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index 1a7cebd..c687849 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -3298,6 +3298,11 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
 	mutex_init(&ioc->transport_cmds.mutex);
 	init_completion(&ioc->transport_cmds.done);
 
+	/* scsih internal command bits */
+	ioc->scsih_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL);
+	ioc->scsih_cmds.status = MPT2_CMD_NOT_USED;
+	mutex_init(&ioc->scsih_cmds.mutex);
+
 	/* task management internal command bits */
 	ioc->tm_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL);
 	ioc->tm_cmds.status = MPT2_CMD_NOT_USED;
@@ -3332,8 +3337,13 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
 
 	ioc->pfacts = kcalloc(ioc->facts.NumberOfPorts,
 	    sizeof(Mpi2PortFactsReply_t), GFP_KERNEL);
-	if (!ioc->pfacts)
+
+	if (!ioc->base_cmds.reply || !ioc->transport_cmds.reply ||
+	    !ioc->scsih_cmds.reply || !ioc->tm_cmds.reply ||
+	    !ioc->config_cmds.reply || !ioc->ctl_cmds.reply || !ioc->pfacts) {
+		r = -ENOMEM;
 		goto out_free_resources;
+	}
 
 	for (i = 0 ; i < ioc->facts.NumberOfPorts; i++) {
 		r = _base_get_port_facts(ioc, i, CAN_SLEEP);
@@ -3355,6 +3365,7 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
 	pci_set_drvdata(ioc->pdev, NULL);
 	kfree(ioc->tm_cmds.reply);
 	kfree(ioc->transport_cmds.reply);
+	kfree(ioc->scsih_cmds.reply);
 	kfree(ioc->config_cmds.reply);
 	kfree(ioc->base_cmds.reply);
 	kfree(ioc->ctl_cmds.reply);
@@ -3363,6 +3374,7 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
 	ioc->base_cmds.reply = NULL;
 	ioc->tm_cmds.reply = NULL;
 	ioc->transport_cmds.reply = NULL;
+	ioc->scsih_cmds.reply = NULL;
 	ioc->config_cmds.reply = NULL;
 	ioc->pfacts = NULL;
 	return r;
@@ -3391,6 +3403,7 @@ mpt2sas_base_detach(struct MPT2SAS_ADAPTER *ioc)
 	kfree(ioc->base_cmds.reply);
 	kfree(ioc->tm_cmds.reply);
 	kfree(ioc->transport_cmds.reply);
+	kfree(ioc->scsih_cmds.reply);
 	kfree(ioc->config_cmds.reply);
 }