summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/be2iscsi
diff options
context:
space:
mode:
authorMaurizio Lombardi2015-10-01 10:56:25 +0200
committerMartin K. Petersen2016-02-24 03:27:02 +0100
commit0c88740dd2070b9af924ab092d5992ece6d90f4c (patch)
treeea572ecf5db72b0c765467ca61ba7ccbadd745eb /drivers/scsi/be2iscsi
parentscsi: ufs: fix typo in comment (diff)
downloadkernel-qcow2-linux-0c88740dd2070b9af924ab092d5992ece6d90f4c.tar.gz
kernel-qcow2-linux-0c88740dd2070b9af924ab092d5992ece6d90f4c.tar.xz
kernel-qcow2-linux-0c88740dd2070b9af924ab092d5992ece6d90f4c.zip
be2iscsi: Fix memory leak in beiscsi_alloc_mem()
In case of error, the memory allocated for phwi_ctrlr was not freed. Signed-off-by: Maurizio Lombardi <mlombard@redhat.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/be2iscsi')
-rw-r--r--drivers/scsi/be2iscsi/be_main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 0892ee28463f..7243a80b0d6d 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -2726,8 +2726,10 @@ static int beiscsi_alloc_mem(struct beiscsi_hba *phba)
phwi_ctrlr->wrb_context = kzalloc(sizeof(struct hwi_wrb_context) *
phba->params.cxns_per_ctrl,
GFP_KERNEL);
- if (!phwi_ctrlr->wrb_context)
+ if (!phwi_ctrlr->wrb_context) {
+ kfree(phba->phwi_ctrlr);
return -ENOMEM;
+ }
phba->init_mem = kcalloc(SE_MEM_MAX, sizeof(*mem_descr),
GFP_KERNEL);