diff options
author | Robert Elliott <elliott@hp.com> | 2015-01-23 23:42:48 +0100 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2015-02-02 18:57:39 +0100 |
commit | 2c14334278a614f5573a219d309bc7582ffdd126 (patch) | |
tree | 66e98ccd753cd0f449c9e36e49655be84fca2e85 | |
parent | hpsa: report allocation failures while allocating SG chain blocks (diff) | |
download | linux-2c14334278a614f5573a219d309bc7582ffdd126.tar.xz linux-2c14334278a614f5573a219d309bc7582ffdd126.zip |
hpsa: fix memory leak in hpsa_alloc_cmd_pool
Partial allocation failure wasn't handled correctly
Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r-- | drivers/scsi/hpsa.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index dc328ce146bb..a66a50ec3a85 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -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) |