linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] softmac: Fix deadlock of wx_set_essid with assoc work
@ 2007-07-31 12:57 Michael Buesch
  2007-07-31 15:01 ` David Woodhouse
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Buesch @ 2007-07-31 12:57 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-wireless, John Linville

The essid wireless extension does deadlock against the assoc mutex,
as we don't unlock the assoc mutex.

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

--

David, please test if this fixes your deadlock.

Index: bu3sch-wireless-dev/net/ieee80211/softmac/ieee80211softmac_wx.c
===================================================================
--- bu3sch-wireless-dev.orig/net/ieee80211/softmac/ieee80211softmac_wx.c	2007-03-05 18:42:18.000000000 +0100
+++ bu3sch-wireless-dev/net/ieee80211/softmac/ieee80211softmac_wx.c	2007-07-31 14:51:46.000000000 +0200
@@ -98,9 +98,12 @@ ieee80211softmac_wx_set_essid(struct net
 				cancel_delayed_work(&authptr->work);
 			sm->associnfo.bssvalid = 0;
 			sm->associnfo.bssfixed = 0;
-			flush_scheduled_work();
 			sm->associnfo.associating = 0;
 			sm->associnfo.associated = 0;
+			/* Unlock mutex, otherwise we deadlock with the assoc work handler. */
+			mutex_unlock(&sm->associnfo.mutex);
+			flush_scheduled_work();
+			mutex_lock(&sm->associnfo.mutex);
 		}
 	}
 

-- 
Greetings Michael.

^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH] softmac: Fix deadlock of wx_set_essid with assoc work
@ 2007-08-07 10:02 Michael Buesch
  2007-08-07 10:18 ` Michael Buesch
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Buesch @ 2007-08-07 10:02 UTC (permalink / raw)
  To: Greg KH
  Cc: stable, John W. Linville, Johannes Berg, David Woodhouse,
	linux-wireless

The essid wireless extension does deadlock against the assoc mutex,
as we don't unlock the assoc mutex.

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

--

This is included in John's wireless-2.6 tree.

This doesn't fix the whole issue completely, as we shouldn't
flush the workqueue while we are holding the rtnl lock.
But, it turns this bug from a "will 100% always deadlock" into
a "it might deadlock" bug.
A followup patch will come (if someone has some time to do so)
to fix this crap code completely.

Index: bu3sch-wireless-dev/net/ieee80211/softmac/ieee80211softmac_wx.c
===================================================================
--- bu3sch-wireless-dev.orig/net/ieee80211/softmac/ieee80211softmac_wx.c	2007-03-05 18:42:18.000000000 +0100
+++ bu3sch-wireless-dev/net/ieee80211/softmac/ieee80211softmac_wx.c	2007-07-31 14:51:46.000000000 +0200
@@ -98,9 +98,12 @@ ieee80211softmac_wx_set_essid(struct net
 				cancel_delayed_work(&authptr->work);
 			sm->associnfo.bssvalid = 0;
 			sm->associnfo.bssfixed = 0;
-			flush_scheduled_work();
 			sm->associnfo.associating = 0;
 			sm->associnfo.associated = 0;
+			/* Unlock mutex, otherwise we deadlock with the assoc work handler. */
+			mutex_unlock(&sm->associnfo.mutex);
+			flush_scheduled_work();
+			mutex_lock(&sm->associnfo.mutex);
 		}
 	}
 


-- 
Greetings Michael.

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

end of thread, other threads:[~2007-08-07 10:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-31 12:57 [PATCH] softmac: Fix deadlock of wx_set_essid with assoc work Michael Buesch
2007-07-31 15:01 ` David Woodhouse
2007-07-31 18:16   ` Michael Buesch
  -- strict thread matches above, loose matches on Subject: below --
2007-08-07 10:02 Michael Buesch
2007-08-07 10:18 ` Michael Buesch

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).