merged.

Bruce

In message: [linux-yocto][linux-yocto v6.1/standard/nxp-sdk-6.1/nxp-soc & 
v6.1/standard/preempt-rt/nxp-sdk-6.1/nxp-soc][PATCH] soc: imx9: free buf in 
imx9_soc_device_register()
on 07/05/2024 Xiaolei Wang wrote:

> Free unused buffer to avoid memory leak in imx9_soc_device_register().
> 
> unreferenced object 0xffffff8009215180 (size 128):
>    comm "(udev-worker)", pid 309, jiffies 4294901878 (age 65.740s)
>    hex dump (first 32 bytes):
>      6c d3 c9 a7 8d 1c 40 bb b4 b8 63 8a 4b 1d 3d cc l.....@...c.K.=.
>      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ............
>    backtrace:
>      [<00000000bc4d4a8d>] __kmem_cache_alloc_node+0x240/0x330
>      [<00000000a270621f>] __kmalloc+0x68/0x10c
>      [<0000000066f93058>] nvmem_cell_read+0x40/0xe0
>      [<000000004e1a073b>] imx9_init_soc_probe+0x184/0x2fc [soc_imx9]
>      [<00000000c47eaccb>] platform_probe+0x70/0xcc
>      [<00000000fff1f1e6>] really_probe+0xc4/0x2e0
>      [<00000000043f6f98>] __driver_probe_device+0x80/0x120
>      [<000000007de67432>] driver_probe_device+0x48/0x124
>      [<0000000085d153a6>] __driver_attach+0xa4/0x1bc
>      [<00000000319009c3>] bus_for_each_dev+0x80/0xe0
>      [<000000006c7d6c30>] driver_attach+0x2c/0x3c
>      [<00000000e091ba40>] bus_add_driver+0x15c/0x210
>      [<00000000a9b619f5>] driver_register+0x80/0x13c
>      [<00000000bb5b23a5>] __platform_driver_register+0x30/0x40
>      [<00000000095e0d10>] 0xffffffc0012d8028
>      [<000000007dc559b3>] do_one_initcall+0xb0/0x33c
> 
> Signed-off-by: Xiaolei Wang <xiaolei.w...@windriver.com>
> ---
>  drivers/soc/imx/soc-imx9.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/soc/imx/soc-imx9.c b/drivers/soc/imx/soc-imx9.c
> index 517e45923a1f..4d0cf15ad8bc 100644
> --- a/drivers/soc/imx/soc-imx9.c
> +++ b/drivers/soc/imx/soc-imx9.c
> @@ -76,6 +76,7 @@ static int imx9_soc_device_register(struct device *dev)
>       nvmem_cell_put(cell);
>  
>       memcpy(v, buf, min(len, sizeof(v)));
> +     kfree(buf);
>       attr->serial_number = kasprintf(GFP_KERNEL, "%08x%08x%08x%08x", v[0], 
> v[1], v[2], v[3]);
>  
>       if (DIGPROG_MAJOR_UPPER(device_id) == 0x9 && 
> DIGPROG_MAJOR_LOWER(device_id) == 0x2) {
> -- 
> 2.25.1
> 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13904): 
https://lists.yoctoproject.org/g/linux-yocto/message/13904
Mute This Topic: https://lists.yoctoproject.org/mt/105956992/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to