[PATCH] libertas: don't deadlock on associate

Dan Williams dcbw at redhat.com
Fri Oct 20 22:28:01 EDT 2006


libertas_cmd_80211_associate() is run from within
libertas_prepare_and_send_command().  Therefore, it is locked.  But it
called libertas_set_radio_control(), which re-enters
libertas_prepare_and_send_command(), leading to a deadlock on
association.  This patch moves the libertas_set_radio_control() command
to wlan_associate() instead, the (indirect) caller of
libertas_cmd_80211_associate() anyway.

Signed-off-by: Dan Williams <dcbw at redhat.com>

diff --git a/drivers/net/wireless/libertas/wlan_join.c b/drivers/net/wireless/libertas/wlan_join.c
index f0dfc16..7207ece 100644
--- a/drivers/net/wireless/libertas/wlan_join.c
+++ b/drivers/net/wireless/libertas/wlan_join.c
@@ -431,6 +431,7 @@ #endif				/* REASSOCIATION */
  */
 static int wlan_associate(wlan_private * priv, struct bss_descriptor * pBSSDesc)
 {
+	wlan_adapter *Adapter = priv->adapter;
 	int ret;
 
 	ret = libertas_prepare_and_send_command(priv, HostCmd_CMD_802_11_AUTHENTICATE,
@@ -442,6 +443,14 @@ static int wlan_associate(wlan_private *
 		return ret;
 	}
 
+	/* set preamble to firmware */
+	if (Adapter->capInfo.ShortPreamble && pBSSDesc->Cap.ShortPreamble) {
+		Adapter->Preamble = HostCmd_TYPE_SHORT_PREAMBLE;
+	} else {
+		Adapter->Preamble = HostCmd_TYPE_LONG_PREAMBLE;
+	}
+	libertas_set_radio_control(priv);
+
 	ret = libertas_prepare_and_send_command(priv, HostCmd_CMD_802_11_ASSOCIATE,
 				    0, HostCmd_OPTION_WAITFORRSP, 0, pBSSDesc);
 
@@ -812,15 +821,6 @@ int libertas_cmd_80211_associate(wlan_pr
 	       pBSSDesc->MacAddress, sizeof(pAsso->PeerStaAddr));
 	pos += sizeof(pAsso->PeerStaAddr);
 
-	/* set preamble to firmware */
-	if (Adapter->capInfo.ShortPreamble && pBSSDesc->Cap.ShortPreamble) {
-		Adapter->Preamble = HostCmd_TYPE_SHORT_PREAMBLE;
-	} else {
-		Adapter->Preamble = HostCmd_TYPE_LONG_PREAMBLE;
-	}
-
-	libertas_set_radio_control(priv);
-
 	/* set the listen interval */
 	pAsso->ListenInterval = Adapter->ListenInterval;
 





More information about the libertas-dev mailing list