be2iscsi: Fix memory leak in beiscsi_alloc_mem()
Subsystems (2)
PATCH 1/1 be2iscsi: Fix memory leak in beiscsi_alloc_mem()
In case of error, the memory allocated for phwi_ctrlr was not freed.
--- drivers/scsi/be2iscsi/be_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/be2iscsi/be_main.c +3 -1
@@ -2706,8 +2706,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 );
Signature · 1 line
Maurizio Lombardi
ping.
Quoted 24 lines · Maurizio Lombardi
In case of error, the memory allocated for
phwi_ctrlrwas not freed.Signed-off-by Maurizio Lombardi <[email protected]>--- drivers/scsi/be2iscsi/be_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/scsi/be2iscsi/be_main.c +3
-1@@ -2706,8 +2706,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 );
Johannes Thumshirn
Reviewed-byQuoted 24 lines · Maurizio Lombardi
ping.
Quoted 21 lines · Maurizio Lombardi
In case of error, the memory allocated for
phwi_ctrlrwas not freed.Signed-off-by Maurizio Lombardi <[email protected]>--- drivers/scsi/be2iscsi/be_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/scsi/be2iscsi/be_main.c +3
-1@@ -2706,8 +2706,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 ; + }
Quoted 7 lines
drivers/scsi/be2iscsi/be_main.c static int beiscsi_alloc_mem(struct beiscsi_hba *phba) · line 2715
Quoted 3 lines
drivers/scsi/be2iscsi/be_main.c +0
-0phba->init_mem =kcalloc (SE_MEM_MAX ,sizeof (*mem_descr),GFP_KERNEL );--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 10 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Maurizio" == Maurizio Lombardi <[email protected]> writes:
Jitendra,
Please review.
Quoted 24 lines
In case of error, the memory allocated for
phwi_ctrlrwas not freed.Signed-off-by Maurizio Lombardi <[email protected]>--- drivers/scsi/be2iscsi/be_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/scsi/be2iscsi/be_main.c +3
-1@@ -2706,8 +2706,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 );
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
A message that is not in the archive (sent off-list or not yet received): CAJRCtXfbT9OrVVDrnC=1V1B4iFUm+FHN4fxQV1CUCY3pXRHq2Q@mail.gmail.com
Jitendra Bhivare
Reviewed-byIn case of error, the memory allocated for phwi_ctrlr was not freed.
--- drivers/scsi/be2iscsi/be_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/be2iscsi/be_main.c +3 -1
@@ -2706,8 +2706,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 );
--
Maurizio Lombardi
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Thanks,
JB
Martin K. Petersen
AppliedQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Jitendra" == Jitendra Bhivare <[email protected]> writes:
Jitendra> In case of error, the memory allocated for phwi_ctrlr was not Jitendra> freed.
Applied to 4.6/scsi-queue.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering