Re: [PATCH] wlcore: spi: Fix a memory leaking bug in wl1271_probe()
From: Kalle Valo <hidden>
Date: 2019-05-28 11:39:25
Also in:
linux-wireless, lkml
From: Kalle Valo <hidden>
Date: 2019-05-28 11:39:25
Also in:
linux-wireless, lkml
Gen Zhang [off-list ref] wrote:
In wl1271_probe(), 'glue->core' is allocated by platform_device_alloc(), when this allocation fails, ENOMEM is returned. However, 'pdev_data' and 'glue' are allocated by devm_kzalloc() before 'glue->core'. When platform_device_alloc() returns NULL, we should also free 'pdev_data' and 'glue' before wl1271_probe() ends to prevent leaking memory. Similarly, we shoulf free 'pdev_data' when 'glue' is NULL. And we should free 'pdev_data' and 'glue' when 'glue->reg' is error and when 'ret' is error. Further, we should free 'glue->core', 'pdev_data' and 'glue' when this function normally ends to prevent leaking memory. Signed-off-by: Gen Zhang <redacted>
Same questions as with similar SDIO patch: https://patchwork.kernel.org/patch/10959049/ Patch set to Changes Requested. -- https://patchwork.kernel.org/patch/10959053/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches