Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

be2iscsi : Fix memory leak in the unload path

Driver was not freeing the DMA memory allocated for EQ/CQ in the
unload path. This patch frees the DMA memory during the driver unload.

Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Odin.com>

authored by

John Soni Jose and committed by
James Bottomley
4e2bdf7a e307f3ac

+12 -6
+12 -6
drivers/scsi/be2iscsi/be_main.c
··· 3695 3695 struct be_ctrl_info *ctrl = &phba->ctrl; 3696 3696 3697 3697 q = &phba->ctrl.mcc_obj.q; 3698 - if (q->created) 3698 + if (q->created) { 3699 3699 beiscsi_cmd_q_destroy(ctrl, q, QTYPE_MCCQ); 3700 - be_queue_free(phba, q); 3700 + be_queue_free(phba, q); 3701 + } 3701 3702 3702 3703 q = &phba->ctrl.mcc_obj.cq; 3703 - if (q->created) 3704 + if (q->created) { 3704 3705 beiscsi_cmd_q_destroy(ctrl, q, QTYPE_CQ); 3705 - be_queue_free(phba, q); 3706 + be_queue_free(phba, q); 3707 + } 3706 3708 } 3707 3709 3708 3710 static void hwi_cleanup(struct beiscsi_hba *phba) ··· 3748 3746 3749 3747 for (i = 0; i < (phba->num_cpus); i++) { 3750 3748 q = &phwi_context->be_cq[i]; 3751 - if (q->created) 3749 + if (q->created) { 3750 + be_queue_free(phba, q); 3752 3751 beiscsi_cmd_q_destroy(ctrl, q, QTYPE_CQ); 3752 + } 3753 3753 } 3754 3754 3755 3755 be_mcc_queues_destroy(phba); ··· 3761 3757 eq_for_mcc = 0; 3762 3758 for (i = 0; i < (phba->num_cpus + eq_for_mcc); i++) { 3763 3759 q = &phwi_context->be_eq[i].q; 3764 - if (q->created) 3760 + if (q->created) { 3761 + be_queue_free(phba, q); 3765 3762 beiscsi_cmd_q_destroy(ctrl, q, QTYPE_EQ); 3763 + } 3766 3764 } 3767 3765 be_cmd_fw_uninit(ctrl); 3768 3766 }