Skip to content

Commit

Permalink
cciss: Add missing allocation in scsi_cmd_stack_setup and correspondi…
Browse files Browse the repository at this point in the history
…ng deallocation

This bit got lost somewhere along the way.  Without this, panic.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Cc: stable@kernel.org
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
  • Loading branch information
Stephen M. Cameron authored and Jens Axboe committed Mar 11, 2011
1 parent 957c2ec commit 978eb51
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/block/cciss_scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ scsi_cmd_stack_setup(ctlr_info_t *h, struct cciss_scsi_adapter_data_t *sa)
return -ENOMEM;
}

stk->elem = kmalloc(sizeof(stk->elem[0]) * stk->nelems, GFP_KERNEL);
if (!stk->elem) {
pci_free_consistent(h->pdev, size, stk->pool,
stk->cmd_pool_handle);
return -1;
}

for (i=0; i<CMD_STACK_SIZE; i++) {
stk->elem[i] = &stk->pool[i];
stk->elem[i]->busaddr = (__u32) (stk->cmd_pool_handle +
Expand Down Expand Up @@ -255,6 +262,8 @@ scsi_cmd_stack_free(ctlr_info_t *h)
pci_free_consistent(h->pdev, size, stk->pool, stk->cmd_pool_handle);
stk->pool = NULL;
cciss_free_sg_chain_blocks(sa->cmd_sg_list, CMD_STACK_SIZE);
kfree(stk->elem);
stk->elem = NULL;
}

#if 0
Expand Down

0 comments on commit 978eb51

Please sign in to comment.