* [PATCH] cciss: memory leak in cciss_init_one()
@ 2009-08-05 10:41 Eric Dumazet
2009-08-23 9:02 ` Eric Dumazet
0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2009-08-05 10:41 UTC (permalink / raw)
To: Mike Miller; +Cc: linux kernel, stable, Jens Axboe, FUJITA Tomonori
commit 22bece00dc1f28dd3374c55e464c9f02eb642876
(cciss: fix regression firmware not displayed in procfs)
added a small memory leak in cciss_init_one()
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index a52cc7f..0589dfb 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -3889,7 +3889,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
int j = 0;
int rc;
int dac, return_code;
- InquiryData_struct *inq_buff = NULL;
+ InquiryData_struct *inq_buff;
if (reset_devices) {
/* Reset the controller with a PCI power-cycle */
@@ -4029,6 +4029,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
printk(KERN_WARNING "cciss: unable to determine firmware"
" version of controller\n");
}
+ kfree(inq_buff);
cciss_procinit(i);
@@ -4045,7 +4046,6 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
return 1;
clean4:
- kfree(inq_buff);
kfree(hba[i]->cmd_pool_bits);
if (hba[i]->cmd_pool)
pci_free_consistent(hba[i]->pdev,
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH] cciss: memory leak in cciss_init_one()
2009-08-05 10:41 [PATCH] cciss: memory leak in cciss_init_one() Eric Dumazet
@ 2009-08-23 9:02 ` Eric Dumazet
2009-08-24 8:01 ` Jens Axboe
0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2009-08-23 9:02 UTC (permalink / raw)
To: Andrew Morton
Cc: Mike Miller, linux kernel, stable, Jens Axboe, FUJITA Tomonori
Andrew, I originally sent this 18 days ago and got no reply yet,
maybe could you get the baby ?
Thanks
[PATCH] cciss: memory leak in cciss_init_one()
commit 22bece00dc1f28dd3374c55e464c9f02eb642876
(cciss: fix regression firmware not displayed in procfs)
added a small memory leak in cciss_init_one()
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index a52cc7f..0589dfb 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -3889,7 +3889,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
int j = 0;
int rc;
int dac, return_code;
- InquiryData_struct *inq_buff = NULL;
+ InquiryData_struct *inq_buff;
if (reset_devices) {
/* Reset the controller with a PCI power-cycle */
@@ -4029,6 +4029,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
printk(KERN_WARNING "cciss: unable to determine firmware"
" version of controller\n");
}
+ kfree(inq_buff);
cciss_procinit(i);
@@ -4045,7 +4046,6 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
return 1;
clean4:
- kfree(inq_buff);
kfree(hba[i]->cmd_pool_bits);
if (hba[i]->cmd_pool)
pci_free_consistent(hba[i]->pdev,
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] cciss: memory leak in cciss_init_one()
2009-08-23 9:02 ` Eric Dumazet
@ 2009-08-24 8:01 ` Jens Axboe
2009-08-24 16:03 ` Miller, Mike (OS Dev)
0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2009-08-24 8:01 UTC (permalink / raw)
To: Eric Dumazet
Cc: Andrew Morton, Mike Miller, linux kernel, stable, FUJITA Tomonori
On Sun, Aug 23 2009, Eric Dumazet wrote:
> Andrew, I originally sent this 18 days ago and got no reply yet,
> maybe could you get the baby ?
I'll add it for 2.6.32.
>
> Thanks
>
> [PATCH] cciss: memory leak in cciss_init_one()
>
> commit 22bece00dc1f28dd3374c55e464c9f02eb642876
> (cciss: fix regression firmware not displayed in procfs)
> added a small memory leak in cciss_init_one()
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> ---
> diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
> index a52cc7f..0589dfb 100644
> --- a/drivers/block/cciss.c
> +++ b/drivers/block/cciss.c
> @@ -3889,7 +3889,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
> int j = 0;
> int rc;
> int dac, return_code;
> - InquiryData_struct *inq_buff = NULL;
> + InquiryData_struct *inq_buff;
>
> if (reset_devices) {
> /* Reset the controller with a PCI power-cycle */
> @@ -4029,6 +4029,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
> printk(KERN_WARNING "cciss: unable to determine firmware"
> " version of controller\n");
> }
> + kfree(inq_buff);
>
> cciss_procinit(i);
>
> @@ -4045,7 +4046,6 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
> return 1;
>
> clean4:
> - kfree(inq_buff);
> kfree(hba[i]->cmd_pool_bits);
> if (hba[i]->cmd_pool)
> pci_free_consistent(hba[i]->pdev,
>
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread* RE: [PATCH] cciss: memory leak in cciss_init_one()
2009-08-24 8:01 ` Jens Axboe
@ 2009-08-24 16:03 ` Miller, Mike (OS Dev)
2009-08-24 16:37 ` Eric Dumazet
0 siblings, 1 reply; 5+ messages in thread
From: Miller, Mike (OS Dev) @ 2009-08-24 16:03 UTC (permalink / raw)
To: Jens Axboe, Eric Dumazet
Cc: Andrew Morton, linux kernel, stable@kernel.org, FUJITA Tomonori
> -----Original Message-----
> From: Jens Axboe [mailto:jens.axboe@oracle.com]
> Sent: Monday, August 24, 2009 3:01 AM
> To: Eric Dumazet
> Cc: Andrew Morton; Miller, Mike (OS Dev); linux kernel;
> stable@kernel.org; FUJITA Tomonori
> Subject: Re: [PATCH] cciss: memory leak in cciss_init_one()
>
> On Sun, Aug 23 2009, Eric Dumazet wrote:
> > Andrew, I originally sent this 18 days ago and got no reply
> yet, maybe
> > could you get the baby ?
>
> I'll add it for 2.6.32.
>
I guess I'm missing something. Where is the leak?
-- mikem
> >
> > Thanks
> >
> > [PATCH] cciss: memory leak in cciss_init_one()
> >
> > commit 22bece00dc1f28dd3374c55e464c9f02eb642876
> > (cciss: fix regression firmware not displayed in procfs)
> added a small
> > memory leak in cciss_init_one()
> >
> > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> > ---
> > diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index
> > a52cc7f..0589dfb 100644
> > --- a/drivers/block/cciss.c
> > +++ b/drivers/block/cciss.c
> > @@ -3889,7 +3889,7 @@ static int __devinit
> cciss_init_one(struct pci_dev *pdev,
> > int j = 0;
> > int rc;
> > int dac, return_code;
> > - InquiryData_struct *inq_buff = NULL;
> > + InquiryData_struct *inq_buff;
> >
> > if (reset_devices) {
> > /* Reset the controller with a PCI power-cycle
> */ @@ -4029,6
> > +4029,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
> > printk(KERN_WARNING "cciss: unable to determine
> firmware"
> > " version of controller\n");
> > }
> > + kfree(inq_buff);
> >
> > cciss_procinit(i);
> >
> > @@ -4045,7 +4046,6 @@ static int __devinit
> cciss_init_one(struct pci_dev *pdev,
> > return 1;
> >
> > clean4:
> > - kfree(inq_buff);
> > kfree(hba[i]->cmd_pool_bits);
> > if (hba[i]->cmd_pool)
> > pci_free_consistent(hba[i]->pdev,
> >
>
> --
> Jens Axboe
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] cciss: memory leak in cciss_init_one()
2009-08-24 16:03 ` Miller, Mike (OS Dev)
@ 2009-08-24 16:37 ` Eric Dumazet
0 siblings, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2009-08-24 16:37 UTC (permalink / raw)
To: Miller, Mike (OS Dev)
Cc: Jens Axboe, Andrew Morton, linux kernel, stable@kernel.org,
FUJITA Tomonori
Miller, Mike (OS Dev) a écrit :
>
>
>> -----Original Message-----
>> From: Jens Axboe [mailto:jens.axboe@oracle.com]
>> Sent: Monday, August 24, 2009 3:01 AM
>> To: Eric Dumazet
>> Cc: Andrew Morton; Miller, Mike (OS Dev); linux kernel;
>> stable@kernel.org; FUJITA Tomonori
>> Subject: Re: [PATCH] cciss: memory leak in cciss_init_one()
>>
>> On Sun, Aug 23 2009, Eric Dumazet wrote:
>>> Andrew, I originally sent this 18 days ago and got no reply
>> yet, maybe
>>> could you get the baby ?
>> I'll add it for 2.6.32.
>>
>
> I guess I'm missing something. Where is the leak?
Well...
Problem is : In normal path, kfree(inq_buff); is not called.
It is called only if a "goto clean4;" is done (error path,
and in this case, inq_buff is NULL anyway)
So we exit from cciss_init_one() without freeing
a "InquiryData_struct" structure.
I am pretty sure kmemleak would complain on this leak :)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-08-24 16:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-05 10:41 [PATCH] cciss: memory leak in cciss_init_one() Eric Dumazet
2009-08-23 9:02 ` Eric Dumazet
2009-08-24 8:01 ` Jens Axboe
2009-08-24 16:03 ` Miller, Mike (OS Dev)
2009-08-24 16:37 ` Eric Dumazet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox