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

The essid wireless extension does deadlock against the assoc mutex,
as we don't unlock the assoc mutex when flushing the workqueue, which
also holds the lock.

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

--

David, please stresstest this.
John, please apply this, if David reports success from his tests.
John, please notify me when you applied this, so I can immediately
send it to -stable.

Index: bu3sch-wireless-dev/net/ieee80211/softmac/ieee80211softmac_wx.c
===================================================================
--- bu3sch-wireless-dev.orig/net/ieee80211/softmac/ieee80211softmac_wx.c	2007-07-14 18:18:06.000000000 +0200
+++ bu3sch-wireless-dev/net/ieee80211/softmac/ieee80211softmac_wx.c	2007-07-31 20:30:08.000000000 +0200
@@ -74,8 +74,8 @@ ieee80211softmac_wx_set_essid(struct net
 	struct ieee80211softmac_auth_queue_item *authptr;
 	int length = 0;
 
+check_assoc_again:
 	mutex_lock(&sm->associnfo.mutex);
-
 	/* Check if we're already associating to this or another network
 	 * If it's another network, cancel and start over with our new network
 	 * If it's our network, ignore the change, we're already doing it!
@@ -98,13 +98,18 @@ 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;
+			/* We must unlock to avoid deadlocks with the assoc workqueue
+			 * on the associnfo.mutex */
+			mutex_unlock(&sm->associnfo.mutex);
+			flush_scheduled_work();
+			/* Avoid race! Check assoc status again. Maybe someone started an
+			 * association while we flushed. */
+			goto check_assoc_again;
 		}
 	}
 
-
 	sm->associnfo.static_essid = 0;
 	sm->associnfo.assoc_wait = 0;
 

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

* Re: [PATCH final] softmac: Fix deadlock of wx_set_essid with assoc  work
  2007-07-31 18:41 [PATCH final] softmac: Fix deadlock of wx_set_essid with assoc work Michael Buesch
@ 2007-08-01 10:48 ` David Woodhouse
  2007-08-01 10:51   ` Michael Buesch
  0 siblings, 1 reply; 4+ messages in thread
From: David Woodhouse @ 2007-08-01 10:48 UTC (permalink / raw)
  To: Michael Buesch; +Cc: John Linville, linux-wireless

On Tue, 2007-07-31 at 20:41 +0200, Michael Buesch wrote:
> David, please stresstest this.

It seemed to survive being left with NetworkManager overnight, which the
2.6.22.1 kernel was consistently failing to cope with beforehand.

-- 
dwmw2


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

* Re: [PATCH final] softmac: Fix deadlock of wx_set_essid with assoc work
  2007-08-01 10:48 ` David Woodhouse
@ 2007-08-01 10:51   ` Michael Buesch
  2007-08-01 11:56     ` Larry Finger
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Buesch @ 2007-08-01 10:51 UTC (permalink / raw)
  To: David Woodhouse; +Cc: John Linville, linux-wireless

On Wednesday 01 August 2007, David Woodhouse wrote:
> On Tue, 2007-07-31 at 20:41 +0200, Michael Buesch wrote:
> > David, please stresstest this.
> 
> It seemed to survive being left with NetworkManager overnight, which the
> 2.6.22.1 kernel was consistently failing to cope with beforehand.

So John, please apply this.

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

* Re: [PATCH final] softmac: Fix deadlock of wx_set_essid with assoc  work
  2007-08-01 10:51   ` Michael Buesch
@ 2007-08-01 11:56     ` Larry Finger
  0 siblings, 0 replies; 4+ messages in thread
From: Larry Finger @ 2007-08-01 11:56 UTC (permalink / raw)
  To: Michael Buesch; +Cc: David Woodhouse, John Linville, linux-wireless

Michael Buesch wrote:
> On Wednesday 01 August 2007, David Woodhouse wrote:
>> On Tue, 2007-07-31 at 20:41 +0200, Michael Buesch wrote:
>>> David, please stresstest this.
>> It seemed to survive being left with NetworkManager overnight, which the
>> 2.6.22.1 kernel was consistently failing to cope with beforehand.
> 
> So John, please apply this.

ACK.

Larry

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

end of thread, other threads:[~2007-08-01 11:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-31 18:41 [PATCH final] softmac: Fix deadlock of wx_set_essid with assoc work Michael Buesch
2007-08-01 10:48 ` David Woodhouse
2007-08-01 10:51   ` Michael Buesch
2007-08-01 11:56     ` Larry Finger

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