linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: wenxiong@linux.vnet.ibm.com
To: James.Bottomley@HansenPartnership.com
Cc: linux-scsi@vger.kernel.org, klebers@linux.vnet.ibm.com,
	brking@linux.vnet.ibm.com,
	Wen Xiong <wenxiong@linux.vnet.ibm.com>
Subject: [PATCH 2/7] RESEND ipr: Handler ID memory allocation failure
Date: Mon, 03 Dec 2012 12:31:14 -0600	[thread overview]
Message-ID: <20121203183211.906863907@linux.vnet.ibm.com> (raw)
In-Reply-To: 20121203183112.822371464@linux.vnet.ibm.com

[-- Attachment #1: fix_mem_alloc_fail --]
[-- Type: text/plain, Size: 1244 bytes --]

From: Brian King <brking@linux.vnet.ibm.com>

Add code to handle memory allocation failures at module load time.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Wen Xiong <wenxiong@linux.vnet.ibm.com>
---

 drivers/scsi/ipr.c |    7 +++++++
 1 file changed, 7 insertions(+)

Index: b/drivers/scsi/ipr.c
===================================================================
--- a/drivers/scsi/ipr.c	2012-11-14 23:07:30.067656109 -0600
+++ b/drivers/scsi/ipr.c	2012-11-14 23:09:49.484214019 -0600
@@ -8516,6 +8516,10 @@ static int __devinit ipr_alloc_mem(struc
 					     BITS_TO_LONGS(ioa_cfg->max_devs_supported), GFP_KERNEL);
 		ioa_cfg->vset_ids = kzalloc(sizeof(unsigned long) *
 					    BITS_TO_LONGS(ioa_cfg->max_devs_supported), GFP_KERNEL);
+
+		if (!ioa_cfg->target_ids || !ioa_cfg->array_ids
+			|| !ioa_cfg->vset_ids)
+			goto out_free_res_entries;
 	}
 
 	for (i = 0; i < ioa_cfg->max_devs_supported; i++) {
@@ -8591,6 +8595,9 @@ out_free_vpd_cbs:
 			    ioa_cfg->vpd_cbs, ioa_cfg->vpd_cbs_dma);
 out_free_res_entries:
 	kfree(ioa_cfg->res_entries);
+	kfree(ioa_cfg->target_ids);
+	kfree(ioa_cfg->array_ids);
+	kfree(ioa_cfg->vset_ids);
 	goto out;
 }
 

-- 

  parent reply	other threads:[~2012-12-03 18:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-03 18:31 [PATCH 0/7] RESEND Add support for new IBM SAS controllers wenxiong
2012-12-03 18:31 ` [PATCH 1/7] RESEND ipr: Add sereral new CCIN definitions for new adapters support wenxiong
2012-12-03 18:31 ` wenxiong [this message]
2012-12-03 18:31 ` [PATCH 3/7] RESEND ipr: Resource path error logging cleanup wenxiong
2012-12-03 18:31 ` [PATCH 4/7] RESEND ipr: Add support for MSI-X and distributed completion wenxiong
2012-12-03 18:31 ` [PATCH 5/7] RESEND ipr: Reduce lock contention wenxiong
2012-12-03 18:31 ` [PATCH 6/7] RESEND ipr: Implement block iopoll wenxiong
2012-12-03 18:31 ` [PATCH 7/7] RESEND ipr: Driver version 2.6.0 wenxiong
2012-12-04 21:06 ` [PATCH 0/7] RESEND Add support for new IBM SAS controllers Brian King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121203183211.906863907@linux.vnet.ibm.com \
    --to=wenxiong@linux.vnet.ibm.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=brking@linux.vnet.ibm.com \
    --cc=klebers@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).