LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] net: wireless: b43: Avoid possible double calls to b43_one_core_detach()
@ 2019-05-04  9:10 Jia-Ju Bai
  2019-05-06  8:21 ` Kalle Valo
  2019-05-28 12:43 ` [PATCH] " Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Jia-Ju Bai @ 2019-05-04  9:10 UTC (permalink / raw)
  To: kvalo, davem, colin.king, yuehaibing
  Cc: linux-wireless, b43-dev, netdev, linux-kernel, 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.

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

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

diff --git a/drivers/net/wireless/broadcom/b43/main.c b/drivers/net/wireless/broadcom/b43/main.c
index 74be3c809225..e666a472a0da 100644
--- a/drivers/net/wireless/broadcom/b43/main.c
+++ b/drivers/net/wireless/broadcom/b43/main.c
@@ -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);
 }
-- 
2.17.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-28 12:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-04  9:10 [PATCH] net: wireless: b43: Avoid possible double calls to b43_one_core_detach() Jia-Ju Bai
2019-05-06  8:21 ` Kalle Valo
2019-05-28 12:43 ` [PATCH] " Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).