RE: Memory leaks on l-o kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Adding LO list:
(Cc'ng Madhu)
Some additional memory leak (not the one reported by CONFIG_DEBUG_KMEMLEAK):

1. In twl4030_mmc_init struct_ omap_mmc_platform_data is allocated using kzalloc.
2. The pointer to the allocated memory is stored in hsmmc_data which is __initdata (contents will be lost after the init section cleanup).
Now look at this piece of code:

mmc = kzalloc(sizeof(struct omap_mmc_platform_data), GFP_KERNEL);
                if (!mmc) {
                        pr_err("Cannot allocate memory for mmc device!\n");
                        return;
                }

This is within a loop. For all but first iteration if kzalloc fails, the function returns and the hsmmc_data is cleaned up (during the init memory cleanup) and pointer to the successfully allocated omap_mmc_platform_data blocks are lost. 

Thanks,
-Romit

>-----Original Message-----
>From: Gadiyar, Anand
>Sent: Friday, September 18, 2009 3:27 PM
>To: olbpdev@xxxxxxxxxxx - OMAP Linux Baseport Development Team (May contain
>non-TIers)
>Subject: Memory leaks on l-o kernel
>
>I enabled CONFIG_DEBUG_KMEMLEAK on the linux-omap kernel, and at boot it
>throws up this on the SDP:
>
>Worth a look?
>
>kmemleak: 2 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
>
>/ # cat /sys/kernel/debug/kmemleak
>unreferenced object 0xc78e7c00 (size 192):
>  comm "swapper", pid 1, jiffies 4294928994
>  backtrace:
>    [<c002fa38>] save_stack_trace+0x24/0x28
>    [<c00a61b0>] create_object+0x134/0x21c
>    [<c00a63b4>] kmemleak_alloc+0x40/0x84
>    [<c00a3d74>] kmem_cache_alloc+0xa8/0xb8
>    [<c000f224>] twl4030_mmc_init+0x54/0x298
>    [<c003b1d4>] sdp3430_twl_gpio_setup+0x2c/0x84
>    [<c02bfa14>] gpio_twl4030_probe+0x198/0x1b4
>    [<c01c79c0>] platform_drv_probe+0x20/0x24
>    [<c01c6ab8>] driver_probe_device+0xa8/0x154
>    [<c01c6c34>] __device_attach+0x44/0x48
>    [<c01c6044>] bus_for_each_drv+0x50/0x90
>    [<c01c6cbc>] device_attach+0x58/0x70
>    [<c01c5e80>] bus_attach_device+0x30/0x64
>    [<c01c488c>] device_add+0x3fc/0x560
>    [<c01c8044>] platform_device_add+0xfc/0x158
>    [<c01cd5b0>] add_numbered_child+0xe4/0x130
>unreferenced object 0xc78e7d00 (size 192):
>  comm "swapper", pid 1, jiffies 4294928994
>  backtrace:
>    [<c002fa38>] save_stack_trace+0x24/0x28
>    [<c00a61b0>] create_object+0x134/0x21c
>    [<c00a63b4>] kmemleak_alloc+0x40/0x84
>    [<c00a3d74>] kmem_cache_alloc+0xa8/0xb8
>    [<c000f224>] twl4030_mmc_init+0x54/0x298
>    [<c003b1d4>] sdp3430_twl_gpio_setup+0x2c/0x84
>    [<c02bfa14>] gpio_twl4030_probe+0x198/0x1b4
>    [<c01c79c0>] platform_drv_probe+0x20/0x24
>    [<c01c6ab8>] driver_probe_device+0xa8/0x154
>    [<c01c6c34>] __device_attach+0x44/0x48
>    [<c01c6044>] bus_for_each_drv+0x50/0x90
>    [<c01c6cbc>] device_attach+0x58/0x70
>    [<c01c5e80>] bus_attach_device+0x30/0x64
>    [<c01c488c>] device_add+0x3fc/0x560
>    [<c01c8044>] platform_device_add+0xfc/0x158
>    [<c01cd5b0>] add_numbered_child+0xe4/0x130
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux