Skip to contentSkip to conversation

of atmel_pmecc_destroy_user

DISCUSSION Dr. David Alan Gilbert 3 participants 4 messages Sep 29, 2024 – Oct 1, 2024 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

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 <[email protected]>
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

Signature · 4 lines
 -----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   |_______/
#1 lore raw

Hi David,

Quoted 21 lines · On Sun, 29 Sep 2024 17:05:01 +0000 "Dr. David Alan Gilbert"…

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 <[email protected]>
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
Quoted 6 lines

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

#2 lore raw
Quoted 28 lines · * Boris Brezillon ([email protected]) wrote:

Hi David,

Quoted 23 lines · On Sun, 29 Sep 2024 17:05:01 +0000 "Dr. David Alan Gilbert"…

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 <[email protected]>
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.

Quoted 8 lines
Quoted 4 lines

(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

Quoted 4 lines

Regards,

Boris

Signature · 4 lines
 -----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   |_______/
maintainer
#3 lore raw

Hi,

[email protected] wrote on Tue, 1 Oct 2024 20:37:18 +0000:

Quoted 34 lines · * Boris Brezillon ([email protected]) wrote:
Quoted 33 lines

Hi David,

Quoted 27 lines · On Sun, 29 Sep 2024 17:05:01 +0000 "Dr. David Alan Gilbert"…

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 <[email protected]>
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?

Quoted 7 lines
Quoted 3 lines

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/[email protected]/T/#u

Thanks for the report,
Miquèl