Skip to contentSkip to conversation

rt2x00: Fix OOPS on failed creation of rt2x00lib workqueue

PATCH New Ivo van Doorn 1 participant 1 message Aug 2, 2008 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rt2x00: Fix OOPS on failed creation of rt2x00lib workqueue

Quoted 1 line

From a0e6b7826159f3e0eb86a8de74a2bb873b40039c Mon Sep 17 00:00:00 2001

From: Colin Ian King <[email protected]>
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.

---
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(-)
drivers/net/wireless/rt2x00/rt2x00dev.c +4 -2
index c997d4f..dde6078 100644
@@ -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.
Signature · 1 line
1.5.4.3