[PATCH] b43: fix memory leak

Subsystems: b43 wireless driver, the rest

STALE3824d

3 messages, 3 authors, 2016-02-18 · open the first message on its own page

[PATCH] b43: fix memory leak

From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Date: 2016-02-18 12:34:49

From: Sudip Mukherjee <redacted>

On error we jumped to the label bcma_out and returned the error code but
we missed freeing dev.

Signed-off-by: Sudip Mukherjee <redacted>
---
 drivers/net/wireless/broadcom/b43/main.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/net/wireless/broadcom/b43/main.c b/drivers/net/wireless/broadcom/b43/main.c
index c279211..78f670a 100644
--- a/drivers/net/wireless/broadcom/b43/main.c
+++ b/drivers/net/wireless/broadcom/b43/main.c
@@ -5671,6 +5671,7 @@ static int b43_bcma_probe(struct bcma_device *core)
 	wl = b43_wireless_init(dev);
 	if (IS_ERR(wl)) {
 		err = PTR_ERR(wl);
+		kfree(dev);
 		goto bcma_out;
 	}
 
-- 
1.9.1

Re: [PATCH] b43: fix memory leak

From: Rafał Miłecki <zajec5@gmail.com>
Date: 2016-02-18 13:40:23

On 18 February 2016 at 13:34, Sudip Mukherjee
[off-list ref] wrote:
From: Sudip Mukherjee <redacted>

On error we jumped to the label bcma_out and returned the error code but
we missed freeing dev.
What if b43_one_core_attach fails? Won't we miss kfree then as well?
Shouldn't you simply improve error path and maybe use an additional
label? Also may we be missing a proper free in b43_bcma_remove as
well?

Your patch subject could also be a bit more descriptive (e.g. what
memory leak exactly is it).

Re: [PATCH] b43: fix memory leak

From: Michael Büsch <m@bues.ch>
Date: 2016-02-18 16:32:45

On Thu, 18 Feb 2016 18:04:36 +0530
Sudip Mukherjee [off-list ref] wrote:
quoted hunk
From: Sudip Mukherjee <redacted>

On error we jumped to the label bcma_out and returned the error code but
we missed freeing dev.

Signed-off-by: Sudip Mukherjee <redacted>
---
 drivers/net/wireless/broadcom/b43/main.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/net/wireless/broadcom/b43/main.c b/drivers/net/wireless/broadcom/b43/main.c
index c279211..78f670a 100644
--- a/drivers/net/wireless/broadcom/b43/main.c
+++ b/drivers/net/wireless/broadcom/b43/main.c
@@ -5671,6 +5671,7 @@ static int b43_bcma_probe(struct bcma_device *core)
 	wl = b43_wireless_init(dev);
 	if (IS_ERR(wl)) {
 		err = PTR_ERR(wl);
+		kfree(dev);
 		goto bcma_out;
 	}
 
We recently had a patch that fixes this, among more leaks. Subject:
[PATCH v2 resend] b43: Fix memory leaks in b43_bus_dev_ssb_init and
b43_bus_dev_bcma_init

Please test that patch instead, so we can finally apply it.

It needs to be tested on both ssb and bcma. Come on. This isn't too
hard. :) Please somebody with any hardware test it. (I currently don't
have any b43 hardware)

-- 
Michael
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help