Search Linux Wireless

[PATCH] rt2x00: Fix OOPS on failed creation of rt2x00lib workqueue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From a0e6b7826159f3e0eb86a8de74a2bb873b40039c Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
Date: Fri, 1 Aug 2008 09:07:21 +0100
Subject: [PATCH] rt2x00: Fix OOPS on failed creation of rt2x00lib workqueue

This fixes a corner case when the rt2x00lib workqueue fails to be created
and rt2x00lib_remove_dev() tries to delete the non-existant workqueue and
causes an OOPS.

Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
Signed-off-by: Ivo van Doorn <IvDoorn@xxxxxxxxx>
---
This patch is intended for 2.6.26-stable only, the code in question was introduced
in 2.6.26 and removed for 2.6.27. The bug which is triggered is rare in normal cases,
but guarenteed when using the wrong driver for the wrong hardware (which can
happen when the same USB ID is used in both drivers).

 drivers/net/wireless/rt2x00/rt2x00dev.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index c997d4f..dde6078 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -1198,8 +1198,10 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
 	 * Stop all queued work. Note that most tasks will already be halted
 	 * during rt2x00lib_disable_radio() and rt2x00lib_uninitialize().
 	 */
-	flush_workqueue(rt2x00dev->workqueue);
-	destroy_workqueue(rt2x00dev->workqueue);
+	if (rt2x00dev->workqueue) {
+		flush_workqueue(rt2x00dev->workqueue);
+		destroy_workqueue(rt2x00dev->workqueue);
+	}
 
 	/*
 	 * Free ieee80211_hw memory.
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux