Skip to contentSkip to conversation

powerpc/rtas_flash: Free kmem upon module exit

PATCH RESEND In review Vasant Hegde 2 participants 4 messages Apr 19, 2013 – Apr 22, 2013 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 powerpc/rtas_flash: Free kmem upon module exit

Memory allocated to flash_block_list in rtas_flash_write is not freed during module exit. We hit below call trace if we unload rtas_flash module after loading new firmware image and before rebooting the system.

Feb  6 08:42:10 eagle3 kernel: kmem_cache_destroy rtas_flash_cache: Slab cache still has objects
Feb  6 08:42:10 eagle3 kernel: Call Trace:
Feb  6 08:42:10 eagle3 kernel: [c00000001c303b40] [c000000000014940] .show_stack+0x70/0x1c0 (unreliable)
Feb  6 08:42:10 eagle3 kernel: [c00000001c303bf0] [c000000000199bec] .kmem_cache_destroy+0x15c/0x170
Feb  6 08:42:10 eagle3 kernel: [c00000001c303c90] [d000000006fa1208] .rtas_flash_cleanup+0x3c/0x80 [rtas_flash]
Feb  6 08:42:10 eagle3 kernel: [c00000001c303e30] [c000000000009954] syscall_exit+0x0/0x94
---
 arch/powerpc/kernel/rtas_flash.c |    5 +++++
 1 file changed, 5 insertions(+)
arch/powerpc/kernel/rtas_flash.c +5 -0
index c642f01..a7020d2 100644
@@ -790,6 +790,11 @@ static void __exit rtas_flash_cleanup(void)
 {
 	rtas_flash_term_hook = NULL;
 
+	if (rtas_firmware_flash_list) {
+		free_flash_list(rtas_firmware_flash_list);
+		rtas_firmware_flash_list = NULL;
+	}
+
 	if (flash_block_cache)
 		kmem_cache_destroy(flash_block_cache);
 
#1 lore raw
Quoted 4 lines · Vasant Hegde

Memory allocated to flash_block_list in rtas_flash_write is not freed during module exit. We hit below call trace if we unload rtas_flash module after loading new firmware image and before rebooting the system.

Why the resend? Did anything change?

cheers

#2 lore raw

Michael,

Quoted 8 lines · Michael Ellerman
Quoted 4 lines · Vasant Hegde

Memory allocated to flash_block_list in rtas_flash_write is not freed during module exit. We hit below call trace if we unload rtas_flash module after loading new firmware image and before rebooting the system.

Why the resend? Did anything change?

Nothing is changed. I resent because it was not reviewed for long time.

-Vasant

Quoted 2 lines

cheers

#3 lore raw
Quoted 9 lines · Vasant Hegde

Michael,

Quoted 6 lines · Michael Ellerman
Quoted 4 lines · Vasant Hegde

Memory allocated to flash_block_list in rtas_flash_write is not freed during module exit. We hit below call trace if we unload rtas_flash module after loading new firmware image and before rebooting the system.

Quoted 4 lines
Quoted 2 lines

Why the resend? Did anything change?

Nothing is changed. I resent because it was not reviewed for long time.

It's in my test branch, which is in linux-next:

https://github.com/mpe/powerpc-test

cheers