All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: stable@kernel.org
Cc: linux-wireless@vger.kernel.org, bcm43xx-dev@lists.berlios.de
Subject: [PATCH stable] b43: Fix controller restart crash
Date: Fri, 6 Jun 2008 15:58:42 +0200	[thread overview]
Message-ID: <200806061558.42998.mb@bu3sch.de> (raw)

This fixes a kernel crash on rmmod, in the case where the controller
was restarted before doing the rmmod.

Upstream commit is 4735f5022c97f6624ced2ec5056c61c4b437d53b

Signed-off-by: Michael Buesch <mb@bu3sch.de>

---

Index: linux-2.6.25.4/drivers/net/wireless/b43/main.c
===================================================================
--- linux-2.6.25.4.orig/drivers/net/wireless/b43/main.c	2008-06-06 15:36:38.000000000 +0200
+++ linux-2.6.25.4/drivers/net/wireless/b43/main.c	2008-06-06 15:36:40.000000000 +0200
@@ -3815,13 +3815,15 @@ static void b43_chip_reset(struct work_s
 		err = b43_wireless_core_start(dev);
 		if (err) {
 			b43_wireless_core_exit(dev);
 			goto out;
 		}
 	}
-      out:
+out:
+	if (err)
+		wl->current_dev = NULL; /* Failed to init the dev. */
 	mutex_unlock(&wl->mutex);
 	if (err)
 		b43err(wl, "Controller restart FAILED\n");
 	else
 		b43info(wl, "Controller restarted\n");
 }
@@ -3964,15 +3966,17 @@ err_powerdown:
 
 static void b43_one_core_detach(struct ssb_device *dev)
 {
 	struct b43_wldev *wldev;
 	struct b43_wl *wl;
 
+	/* Do not cancel ieee80211-workqueue based work here.
+	 * See comment in b43_remove(). */
+
 	wldev = ssb_get_drvdata(dev);
 	wl = wldev->wl;
-	cancel_work_sync(&wldev->restart_work);
 	b43_debugfs_remove_device(wldev);
 	b43_wireless_core_detach(wldev);
 	list_del(&wldev->list);
 	wl->nr_devs--;
 	ssb_set_drvdata(dev, NULL);
 	kfree(wldev);
@@ -4149,12 +4153,16 @@ static int b43_probe(struct ssb_device *
 
 static void b43_remove(struct ssb_device *dev)
 {
 	struct b43_wl *wl = ssb_get_devtypedata(dev);
 	struct b43_wldev *wldev = ssb_get_drvdata(dev);
 
+	/* We must cancel any work here before unregistering from ieee80211,
+	 * as the ieee80211 unreg will destroy the workqueue. */
+	cancel_work_sync(&wldev->restart_work);
+
 	B43_WARN_ON(!wl);
 	if (wl->current_dev == wldev)
 		ieee80211_unregister_hw(wl->hw);
 
 	b43_one_core_detach(dev);
 

             reply	other threads:[~2008-06-06 13:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-06 13:58 Michael Buesch [this message]
2008-06-06 17:32 ` [stable] [PATCH stable] b43: Fix controller restart crash Chris Wright
2008-06-06 17:55   ` Michael Buesch
2008-06-09 15:23     ` John W. Linville

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200806061558.42998.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=bcm43xx-dev@lists.berlios.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=stable@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.