]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
be2iscsi: Fix memory leak in beiscsi_alloc_mem()
authorMaurizio Lombardi <mlombard@redhat.com>
Thu, 1 Oct 2015 08:56:25 +0000 (10:56 +0200)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 10 Mar 2016 15:21:59 +0000 (07:21 -0800)
Orabug: 22725588

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>
Signed-off-by: Dan Duval <dan.duval@oracle.com>
drivers/scsi/be2iscsi/be_main.c

index 0d39d0e80bf4dad7ab6ebe7026b7ac2b390224c6..f27b91c8b0314add9b1759efaa12abded057dd12 100644 (file)
@@ -2718,8 +2718,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);