Skip to contentSkip to conversation

net: wireless: b43: Avoid possible double calls to b43_one_core_detach()

PATCH In review Jia-Ju Bai 2 participants 3 messages May 4, 2019 – May 28, 2019

Subsystems (3)
lore
Share & tools
lore

Jia-Ju Bai

author
#0 lore raw

PATCH 1/1 net: wireless: b43: Avoid possible double calls to b43_one_core_detach()

In b43_request_firmware(), when ieee80211_register_hw() fails, b43_one_core_detach() is called. In b43_bcma_remove() and b43_ssb_remove(), b43_one_core_detach() is called again. In this case, null-pointer dereferences and double-free problems can occur when the driver is removed.

To fix this bug, the call to b43_one_core_detach() in b43_request_firmware() is deleted.

This bug is found by a runtime fuzzing tool named FIZZER written by us.

---
 drivers/net/wireless/broadcom/b43/main.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/net/wireless/broadcom/b43/main.c +1 -6
index 74be3c809225..e666a472a0da 100644
@@ -2610,18 +2610,13 @@ static void b43_request_firmware(struct work_struct *work)
 
 	err = ieee80211_register_hw(wl->hw);
 	if (err)
-		goto err_one_core_detach;
+		goto out;
 	wl->hw_registered = true;
 	b43_leds_register(wl->current_dev);
 
 	/* Register HW RNG driver */
 	b43_rng_init(wl);
 
-	goto out;
-
-err_one_core_detach:
-	b43_one_core_detach(dev->dev);
-
 out:
 	kfree(ctx);
 }
Signature · 1 line
2.17.0
#1 lore raw
Quoted 9 lines · Jia-Ju Bai

In b43_request_firmware(), when ieee80211_register_hw() fails, b43_one_core_detach() is called. In b43_bcma_remove() and b43_ssb_remove(), b43_one_core_detach() is called again. In this case, null-pointer dereferences and double-free problems can occur when the driver is removed.

To fix this bug, the call to b43_one_core_detach() in b43_request_firmware() is deleted.

Quoted 6 lines

This bug is found by a runtime fuzzing tool named FIZZER written by us.

---
 drivers/net/wireless/broadcom/b43/main.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

You can use just "b43:" as prefix, no need to have "net:" nor "wireless:" in the title. I'll fix it this time, but please use correct style in the future.

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#commit_title_is_wrong

Signature · 1 line
Kalle Valo
#2 lore raw

Re: [PATCH] b43: Avoid possible double calls to b43_one_core_detach()

In reply to Jia-Ju Bai
Quoted 6 lines · Jia-Ju Bai

In b43_request_firmware(), when ieee80211_register_hw() fails, b43_one_core_detach() is called. In b43_bcma_remove() and b43_ssb_remove(), b43_one_core_detach() is called again. In this case, null-pointer dereferences and double-free problems can occur when the driver is removed.

Quoted 6 lines

To fix this bug, the call to b43_one_core_detach() in b43_request_firmware() is deleted.

This bug is found by a runtime fuzzing tool named FIZZER written by us.

Patch applied to wireless-drivers-next.git, thanks.

ec2e93cf1910 b43: Avoid possible double calls to b43_one_core_detach()

Signature · 3 lines
https://patchwork.kernel.org/patch/10929623/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches