diff mbox

b43: Fix a memory leak in b43_bus_dev_ssb_init

Message ID 1452483457-568-1-git-send-email-baijiaju1990@163.com (mailing list archive)
State Superseded
Delegated to: Kalle Valo
Headers show

Commit Message

Jia-Ju Bai Jan. 11, 2016, 3:37 a.m. UTC
The memory allocated by kzalloc in b43_bus_dev_ssb_init is not freed.
This patch fixes the bug by adding kfree in b43_ssb_remove.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
---
 drivers/net/wireless/b43/main.c |    1 +
 1 file changed, 1 insertion(+)

Comments

Michael Büsch Jan. 11, 2016, 4:21 p.m. UTC | #1
On Mon, 11 Jan 2016 11:37:36 +0800
Jia-Ju Bai <baijiaju1990@163.com> wrote:

> The memory allocated by kzalloc in b43_bus_dev_ssb_init is not freed.
> This patch fixes the bug by adding kfree in b43_ssb_remove.
> 
> Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
> ---
>  drivers/net/wireless/b43/main.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
> index ec013fb..6d251a0 100644
> --- a/drivers/net/wireless/b43/main.c
> +++ b/drivers/net/wireless/b43/main.c
> @@ -5798,6 +5798,7 @@ static void b43_ssb_remove(struct ssb_device *sdev)
>  
>  	b43_leds_unregister(wl);
>  	b43_wireless_exit(dev, wl);
> +	kfree(dev);
>  }
>  
>  static struct ssb_driver b43_ssb_driver = {



Nice catch.
The kfree is also missing in b43_bcma_remove().
And also in the error paths of b43_bcma_probe().

Can you please extend the patch to cover these, too?
Rafał Miłecki Jan. 11, 2016, 4:42 p.m. UTC | #2
On 11 January 2016 at 04:37, Jia-Ju Bai <baijiaju1990@163.com> wrote:
> The memory allocated by kzalloc in b43_bus_dev_ssb_init is not freed.
> This patch fixes the bug by adding kfree in b43_ssb_remove.

Nice. If you want somethig more to scratch your head, see
"Missing b43 firmware handling"
http://lists.infradead.org/pipermail/b43-dev/2014-June/003467.html
diff mbox

Patch

diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index ec013fb..6d251a0 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -5798,6 +5798,7 @@  static void b43_ssb_remove(struct ssb_device *sdev)
 
 	b43_leds_unregister(wl);
 	b43_wireless_exit(dev, wl);
+	kfree(dev);
 }
 
 static struct ssb_driver b43_ssb_driver = {