All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] be2iscsi: Fix memory leak in beiscsi_alloc_mem()
@ 2015-10-01  8:56 Maurizio Lombardi
  2016-02-10 10:13 ` Maurizio Lombardi
       [not found] ` <CAJRCtXfbT9OrVVDrnC=1V1B4iFUm+FHN4fxQV1CUCY3pXRHq2Q@mail.gmail.com>
  0 siblings, 2 replies; 6+ messages in thread
From: Maurizio Lombardi @ 2015-10-01  8:56 UTC (permalink / raw)
  To: linux-scsi; +Cc: jayamohan.kallickal, minh.tran, sony.john-n, James.Bottomley

In case of error, the memory allocated for phwi_ctrlr was not freed.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
 drivers/scsi/be2iscsi/be_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 7a6dbfb..360aa88 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] be2iscsi: Fix memory leak in beiscsi_alloc_mem()
  2015-10-01  8:56 [PATCH] be2iscsi: Fix memory leak in beiscsi_alloc_mem() Maurizio Lombardi
@ 2016-02-10 10:13 ` Maurizio Lombardi
  2016-02-10 11:07   ` Johannes Thumshirn
  2016-02-10 17:23   ` Martin K. Petersen
       [not found] ` <CAJRCtXfbT9OrVVDrnC=1V1B4iFUm+FHN4fxQV1CUCY3pXRHq2Q@mail.gmail.com>
  1 sibling, 2 replies; 6+ messages in thread
From: Maurizio Lombardi @ 2016-02-10 10:13 UTC (permalink / raw)
  To: linux-scsi; +Cc: jayamohan.kallickal, minh.tran, sony.john-n, James.Bottomley

ping.

On 10/01/2015 10:56 AM, Maurizio Lombardi wrote:
> In case of error, the memory allocated for phwi_ctrlr was not freed.
> 
> Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
> ---
>  drivers/scsi/be2iscsi/be_main.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
> index 7a6dbfb..360aa88 100644
> --- a/drivers/scsi/be2iscsi/be_main.c
> +++ b/drivers/scsi/be2iscsi/be_main.c
> @@ -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);
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] be2iscsi: Fix memory leak in beiscsi_alloc_mem()
  2016-02-10 10:13 ` Maurizio Lombardi
@ 2016-02-10 11:07   ` Johannes Thumshirn
  2016-02-10 17:23   ` Martin K. Petersen
  1 sibling, 0 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2016-02-10 11:07 UTC (permalink / raw)
  To: Maurizio Lombardi
  Cc: linux-scsi, jayamohan.kallickal, minh.tran, sony.john-n, James.Bottomley

On Wed, Feb 10, 2016 at 11:13:39AM +0100, Maurizio Lombardi wrote:
> ping.
> 
> On 10/01/2015 10:56 AM, Maurizio Lombardi wrote:
> > In case of error, the memory allocated for phwi_ctrlr was not freed.
> > 
> > Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
> > ---
> >  drivers/scsi/be2iscsi/be_main.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
> > index 7a6dbfb..360aa88 100644
> > --- a/drivers/scsi/be2iscsi/be_main.c
> > +++ b/drivers/scsi/be2iscsi/be_main.c
> > @@ -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);
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] be2iscsi: Fix memory leak in beiscsi_alloc_mem()
  2016-02-10 10:13 ` Maurizio Lombardi
  2016-02-10 11:07   ` Johannes Thumshirn
@ 2016-02-10 17:23   ` Martin K. Petersen
  1 sibling, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2016-02-10 17:23 UTC (permalink / raw)
  To: Jitendra Bhivare
  Cc: linux-scsi, jayamohan.kallickal, minh.tran, sony.john-n,
	James.Bottomley, Maurizio Lombardi

>>>>> "Maurizio" == Maurizio Lombardi <mlombard@redhat.com> writes:

Jitendra,

Please review.

> In case of error, the memory allocated for phwi_ctrlr was not freed.
> 
> Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
> ---
>  drivers/scsi/be2iscsi/be_main.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
> index 7a6dbfb..360aa88 100644
> --- a/drivers/scsi/be2iscsi/be_main.c
> +++ b/drivers/scsi/be2iscsi/be_main.c
> @@ -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);
> 

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] be2iscsi: Fix memory leak in beiscsi_alloc_mem()
       [not found] ` <CAJRCtXfbT9OrVVDrnC=1V1B4iFUm+FHN4fxQV1CUCY3pXRHq2Q@mail.gmail.com>
@ 2016-02-11 12:59   ` Jitendra Bhivare
  2016-02-11 14:34     ` Martin K. Petersen
  0 siblings, 1 reply; 6+ messages in thread
From: Jitendra Bhivare @ 2016-02-11 12:59 UTC (permalink / raw)
  To: linux-scsi, mlombard
  Cc: jayamohan.kallickal, minh.tran, sony.john-n, James.Bottomley

In case of error, the memory allocated for phwi_ctrlr was not freed.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
---
 drivers/scsi/be2iscsi/be_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 7a6dbfb..360aa88 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>

Thanks,

JB



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] be2iscsi: Fix memory leak in beiscsi_alloc_mem()
  2016-02-11 12:59   ` Jitendra Bhivare
@ 2016-02-11 14:34     ` Martin K. Petersen
  0 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2016-02-11 14:34 UTC (permalink / raw)
  To: Jitendra Bhivare
  Cc: linux-scsi, mlombard, jayamohan.kallickal, minh.tran,
	sony.john-n, James.Bottomley

>>>>> "Jitendra" == Jitendra Bhivare <jitendra.bhivare@broadcom.com> writes:

Jitendra> In case of error, the memory allocated for phwi_ctrlr was not
Jitendra> freed.

Applied to 4.6/scsi-queue.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-02-11 14:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-01  8:56 [PATCH] be2iscsi: Fix memory leak in beiscsi_alloc_mem() Maurizio Lombardi
2016-02-10 10:13 ` Maurizio Lombardi
2016-02-10 11:07   ` Johannes Thumshirn
2016-02-10 17:23   ` Martin K. Petersen
     [not found] ` <CAJRCtXfbT9OrVVDrnC=1V1B4iFUm+FHN4fxQV1CUCY3pXRHq2Q@mail.gmail.com>
2016-02-11 12:59   ` Jitendra Bhivare
2016-02-11 14:34     ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.