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

* Re: [PATCH 3/6] ipr: Fix possible error path oops during initialization
  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
  1 sibling, 0 replies; 3+ messages in thread
From: wenxiong @ 2015-03-27 16:50 UTC (permalink / raw)
  To: Brian King
  Cc: James.Bottomley, hch, linux-scsi, kreling, krisman, dan.carpenter

Reviewed-by: Wen Xiong<wenxiong@linux.vnet.ibm.com>

Thanks,
Wendy

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

> 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

* Re: [PATCH 3/6] ipr: Fix possible error path oops during initialization
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Kreling @ 2015-03-31 13:49 UTC (permalink / raw)
  To: Brian King, James.Bottomley
  Cc: hch, linux-scsi, wenxiong, krisman, dan.carpenter

** Adding 'Reviewed-by' tag **

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

Reported-by: Dan Carpenter

Signed-off-by: Brian King
Reviewed-by: Daniel Kreling
---

  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,1 +9061,1 @@

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)
_

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ 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.