提交 2c143342 编写于 作者: R Robert Elliott 提交者: James Bottomley

hpsa: fix memory leak in hpsa_alloc_cmd_pool

Partial allocation failure wasn't handled correctly
Reviewed-by: NScott Teel <scott.teel@pmcs.com>
Signed-off-by: NRobert Elliott <elliott@hp.com>
Signed-off-by: NDon Brace <don.brace@pmcs.com>
Signed-off-by: NChristoph Hellwig <hch@lst.de>
上级 3d4e6af8
......@@ -211,6 +211,7 @@ static struct CommandList *cmd_special_alloc(struct ctlr_info *h);
static int fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h,
void *buff, size_t size, u16 page_code, unsigned char *scsi3addr,
int cmd_type);
static void hpsa_free_cmd_pool(struct ctlr_info *h);
#define VPD_PAGE (1 << 8)
static int hpsa_scsi_queue_command(struct Scsi_Host *h, struct scsi_cmnd *cmd);
......@@ -6471,9 +6472,12 @@ static int hpsa_allocate_cmd_pool(struct ctlr_info *h)
|| (h->cmd_pool == NULL)
|| (h->errinfo_pool == NULL)) {
dev_err(&h->pdev->dev, "out of memory in %s", __func__);
return -ENOMEM;
goto clean_up;
}
return 0;
clean_up:
hpsa_free_cmd_pool(h);
return -ENOMEM;
}
static void hpsa_free_cmd_pool(struct ctlr_info *h)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册