linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* of atmel_pmecc_destroy_user
@ 2024-09-29 17:05 Dr. David Alan Gilbert
  2024-09-30  7:08 ` Boris Brezillon
  0 siblings, 1 reply; 4+ messages in thread
From: Dr. David Alan Gilbert @ 2024-09-29 17:05 UTC (permalink / raw)
  To: boris.brezillon
  Cc: richard, linux-kernel, linux-mtd, miquel.raynal, linux-arm-kernel

Hi Boris and co,
  One of my scripts noticed that 'atmel_pmecc_destroy_user'
isn't called anywhere; I was going to delete it, but hmm, I wonder
if it's actually a missing call and leaking (in the unlikely case
the device was ever removed).

It was added by your:
  commit f88fc122cc34c2545dec9562eaab121494e401ef
  Author: Boris Brezillon <bbrezillon@kernel.org>
  Date:   Thu Mar 16 09:02:40 2017 +0100

    mtd: nand: Cleanup/rework the atmel_nand driver

and I see the allocation in:
     user = kzalloc(size, GFP_KERNEL);
       in
     nand->pmecc = atmel_pmecc_create_user(nc->pmecc, &req);
       called in atmel_nand_pmecc_init
         from atmel_nand_ecc_init
           from atmel_hsmc_nand_ecc_init
 
But I don't see any freeing.

(I don't knowingly have hardware to test a fix, although I guess
there's probably one somewhere....)

Suggestions?

Thanks,

Dave
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/


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

* Re: of atmel_pmecc_destroy_user
  2024-09-29 17:05 of atmel_pmecc_destroy_user Dr. David Alan Gilbert
@ 2024-09-30  7:08 ` Boris Brezillon
  2024-10-01 20:37   ` Dr. David Alan Gilbert
  0 siblings, 1 reply; 4+ messages in thread
From: Boris Brezillon @ 2024-09-30  7:08 UTC (permalink / raw)
  To: Dr. David Alan Gilbert
  Cc: richard, linux-kernel, linux-mtd, miquel.raynal, linux-arm-kernel

Hi David,

On Sun, 29 Sep 2024 17:05:01 +0000
"Dr. David Alan Gilbert" <linux@treblig.org> wrote:

> Hi Boris and co,
>   One of my scripts noticed that 'atmel_pmecc_destroy_user'
> isn't called anywhere; I was going to delete it, but hmm, I wonder
> if it's actually a missing call and leaking (in the unlikely case
> the device was ever removed).
> 
> It was added by your:
>   commit f88fc122cc34c2545dec9562eaab121494e401ef
>   Author: Boris Brezillon <bbrezillon@kernel.org>
>   Date:   Thu Mar 16 09:02:40 2017 +0100
> 
>     mtd: nand: Cleanup/rework the atmel_nand driver
> 
> and I see the allocation in:
>      user = kzalloc(size, GFP_KERNEL);
>        in
>      nand->pmecc = atmel_pmecc_create_user(nc->pmecc, &req);
>        called in atmel_nand_pmecc_init
>          from atmel_nand_ecc_init
>            from atmel_hsmc_nand_ecc_init
>  
> But I don't see any freeing.
> 
> (I don't knowingly have hardware to test a fix, although I guess
> there's probably one somewhere....)
> 
> Suggestions?

There's definitely a leak. I haven't looked at NAND stuff for a while
though, so I'll let Miquel advise you on where
atmel_pmecc_destroy_user() should be called.

Regards,

Boris


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

* Re: of atmel_pmecc_destroy_user
  2024-09-30  7:08 ` Boris Brezillon
@ 2024-10-01 20:37   ` Dr. David Alan Gilbert
  2024-10-01 20:41     ` Miquel Raynal
  0 siblings, 1 reply; 4+ messages in thread
From: Dr. David Alan Gilbert @ 2024-10-01 20:37 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: richard, linux-kernel, linux-mtd, miquel.raynal, linux-arm-kernel

* Boris Brezillon (boris.brezillon@collabora.com) wrote:
> Hi David,
> 
> On Sun, 29 Sep 2024 17:05:01 +0000
> "Dr. David Alan Gilbert" <linux@treblig.org> wrote:
> 
> > Hi Boris and co,
> >   One of my scripts noticed that 'atmel_pmecc_destroy_user'
> > isn't called anywhere; I was going to delete it, but hmm, I wonder
> > if it's actually a missing call and leaking (in the unlikely case
> > the device was ever removed).
> > 
> > It was added by your:
> >   commit f88fc122cc34c2545dec9562eaab121494e401ef
> >   Author: Boris Brezillon <bbrezillon@kernel.org>
> >   Date:   Thu Mar 16 09:02:40 2017 +0100
> > 
> >     mtd: nand: Cleanup/rework the atmel_nand driver
> > 
> > and I see the allocation in:
> >      user = kzalloc(size, GFP_KERNEL);
> >        in
> >      nand->pmecc = atmel_pmecc_create_user(nc->pmecc, &req);
> >        called in atmel_nand_pmecc_init
> >          from atmel_nand_ecc_init
> >            from atmel_hsmc_nand_ecc_init
> >  
> > But I don't see any freeing.
> > 
> > (I don't knowingly have hardware to test a fix, although I guess
> > there's probably one somewhere....)
> > 
> > Suggestions?
> 
> There's definitely a leak. I haven't looked at NAND stuff for a while
> though, so I'll let Miquel advise you on where
> atmel_pmecc_destroy_user() should be called.

I see Miquel has posted a fix.

Thanks to both of you!

Dave

> Regards,
> 
> Boris
> 
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/


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

* Re: of atmel_pmecc_destroy_user
  2024-10-01 20:37   ` Dr. David Alan Gilbert
@ 2024-10-01 20:41     ` Miquel Raynal
  0 siblings, 0 replies; 4+ messages in thread
From: Miquel Raynal @ 2024-10-01 20:41 UTC (permalink / raw)
  To: Dr. David Alan Gilbert
  Cc: richard, linux-kernel, Boris Brezillon, linux-mtd,
	linux-arm-kernel

Hi,

linux@treblig.org wrote on Tue, 1 Oct 2024 20:37:18 +0000:

> * Boris Brezillon (boris.brezillon@collabora.com) wrote:
> > Hi David,
> > 
> > On Sun, 29 Sep 2024 17:05:01 +0000
> > "Dr. David Alan Gilbert" <linux@treblig.org> wrote:
> >   
> > > Hi Boris and co,
> > >   One of my scripts noticed that 'atmel_pmecc_destroy_user'
> > > isn't called anywhere; I was going to delete it, but hmm, I wonder
> > > if it's actually a missing call and leaking (in the unlikely case
> > > the device was ever removed).
> > > 
> > > It was added by your:
> > >   commit f88fc122cc34c2545dec9562eaab121494e401ef
> > >   Author: Boris Brezillon <bbrezillon@kernel.org>
> > >   Date:   Thu Mar 16 09:02:40 2017 +0100
> > > 
> > >     mtd: nand: Cleanup/rework the atmel_nand driver
> > > 
> > > and I see the allocation in:
> > >      user = kzalloc(size, GFP_KERNEL);
> > >        in
> > >      nand->pmecc = atmel_pmecc_create_user(nc->pmecc, &req);
> > >        called in atmel_nand_pmecc_init
> > >          from atmel_nand_ecc_init
> > >            from atmel_hsmc_nand_ecc_init
> > >  
> > > But I don't see any freeing.
> > > 
> > > (I don't knowingly have hardware to test a fix, although I guess
> > > there's probably one somewhere....)
> > > 
> > > Suggestions?  
> > 
> > There's definitely a leak. I haven't looked at NAND stuff for a while
> > though, so I'll let Miquel advise you on where
> > atmel_pmecc_destroy_user() should be called.  
> 
> I see Miquel has posted a fix.
> 
> Thanks to both of you!

Looks like you've been too fast :) I was waiting for the lore
link to be available, so yes, I looked into it and decided to fix it
this way:

https://lore.kernel.org/linux-mtd/20241001203149.387655-1-miquel.raynal@bootlin.com/T/#u

Thanks for the report,
Miquèl


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

end of thread, other threads:[~2024-10-01 20:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-29 17:05 of atmel_pmecc_destroy_user Dr. David Alan Gilbert
2024-09-30  7:08 ` Boris Brezillon
2024-10-01 20:37   ` Dr. David Alan Gilbert
2024-10-01 20:41     ` Miquel Raynal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).