All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/6] ipr: Fix possible error path oops during initialization
@ 2015-03-26 16:23 Brian King
  2015-03-27 16:50 ` wenxiong
  2015-03-31 13:49 ` Daniel Kreling
  0 siblings, 2 replies; 3+ messages in thread
From: Brian King @ 2015-03-26 16:23 UTC (permalink / raw)
  To: James.Bottomley
  Cc: hch, linux-scsi, wenxiong, kreling, krisman, brking, dan.carpenter


Fixes a possible oops during adapter initialization in some
memory allocation failure error paths scenarios.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

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

 drivers/scsi/ipr.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff -puN drivers/scsi/ipr.c~ipr_free_cmd_blks_oops drivers/scsi/ipr.c
--- linux/drivers/scsi/ipr.c~ipr_free_cmd_blks_oops	2015-03-26 11:14:41.465782868 -0500
+++ linux-bjking1/drivers/scsi/ipr.c	2015-03-26 11:14:41.471782829 -0500
@@ -9061,13 +9061,15 @@ static void ipr_free_cmd_blks(struct ipr
 {
 	int i;
 
-	for (i = 0; i < IPR_NUM_CMD_BLKS; i++) {
-		if (ioa_cfg->ipr_cmnd_list[i])
-			dma_pool_free(ioa_cfg->ipr_cmd_pool,
-				      ioa_cfg->ipr_cmnd_list[i],
-				      ioa_cfg->ipr_cmnd_list_dma[i]);
+	if (ioa_cfg->ipr_cmnd_list) {
+		for (i = 0; i < IPR_NUM_CMD_BLKS; i++) {
+			if (ioa_cfg->ipr_cmnd_list[i])
+				dma_pool_free(ioa_cfg->ipr_cmd_pool,
+					      ioa_cfg->ipr_cmnd_list[i],
+					      ioa_cfg->ipr_cmnd_list_dma[i]);
 
-		ioa_cfg->ipr_cmnd_list[i] = NULL;
+			ioa_cfg->ipr_cmnd_list[i] = NULL;
+		}
 	}
 
 	if (ioa_cfg->ipr_cmd_pool)
_


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-31 13:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-26 16:23 [PATCH 3/6] ipr: Fix possible error path oops during initialization Brian King
2015-03-27 16:50 ` wenxiong
2015-03-31 13:49 ` Daniel Kreling

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.