Skip to content

Commit

Permalink
ipr: Fix possible error path oops during initialization
Browse files Browse the repository at this point in the history
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>
Reviewed-by: Wen Xiong <wenxiong@linux.vnet.ibm.com>
Reviewed-by: Daniel Kreling <kreling@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
  • Loading branch information
Brian King authored and James Bottomley committed Apr 9, 2015
1 parent 2796ca5 commit a65e8f1
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions drivers/scsi/ipr.c
Original file line number Diff line number Diff line change
Expand Up @@ -9060,13 +9060,15 @@ static void ipr_free_cmd_blks(struct ipr_ioa_cfg *ioa_cfg)
{
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]);

ioa_cfg->ipr_cmnd_list[i] = NULL;
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;
}
}

if (ioa_cfg->ipr_cmd_pool)
Expand Down

0 comments on commit a65e8f1

Please sign in to comment.