summaryrefslogtreecommitdiff
blob: e270aa93689936e8d53e7416b858ec0cec6bd6ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
[Bug 455] Fix frequent channel change generates firmware fatal error.

Because of the frequent channel change, it is possible that when we are
try to associate with channel 1 (authenticated but not associated).
Another channel change comes at this time, then the driver will issue
disassociate command to the firmware which will cause the fatal error.

It seems that the association/disassociation procedure should not be
interrupted.

The patch attached adds test on STATUS_ASSOCIATING | STATUS_DISASSOCIATING
in ipw_send_cmd(), when ensures that commands will not be sent to firmware
when we are in these two status.

Signed-off-by: Hong Liu <hong.liu@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
--
diff -Nurp ipw2200-1.0.6-orig/ipw2200.c ipw2200-1.0.6/ipw2200.c
--- ipw2200-1.0.6-orig/ipw2200.c	2005-04-12 17:03:02.000000000 +0800
+++ ipw2200-1.0.6/ipw2200.c	2005-04-13 13:42:03.496914912 +0800
@@ -1592,6 +1592,18 @@ static int ipw_send_cmd(struct ipw_priv 
 		return -1;
 	}
 
+	if (priv->status & STATUS_ASSOCIATING) {
+		IPW_DEBUG_HC("abandon a command while associating\n");
+		spin_unlock_irqrestore(&priv->lock, flags);
+		return -1;
+	}
+
+	if (priv->status & STATUS_DISASSOCIATING) {
+		IPW_DEBUG_HC("abandon a command while disassociating\n");
+		spin_unlock_irqrestore(&priv->lock, flags);
+		return -1;
+	}
+
 	priv->status |= STATUS_HCMD_ACTIVE;
 
 	IPW_DEBUG_HC("Sending %s command (#%d), %d bytes\n",
@@ -3385,14 +3397,17 @@ static void ipw_send_disassociate(struct
 		return;
 	}
 
+	if (priv->status & STATUS_ASSOCIATING) {
+		IPW_DEBUG_ASSOC("Disassociating while associating.\n");
+		queue_work(priv->workqueue, &priv->disassociate);
+		return;
+	}
+
 	IPW_DEBUG_ASSOC("Disassocation attempt from " MAC_FMT " "
 			"on channel %d.\n",
 			MAC_ARG(priv->assoc_request.bssid),
 			priv->assoc_request.channel);
 
-	priv->status &= ~(STATUS_ASSOCIATING | STATUS_ASSOCIATED);
-	priv->status |= STATUS_DISASSOCIATING;
-
 	if (quiet)
 		priv->assoc_request.assoc_type = HC_DISASSOC_QUIET;
 	else
@@ -3404,6 +3419,9 @@ static void ipw_send_disassociate(struct
 		return;
 	}
 
+	priv->status &= ~(STATUS_ASSOCIATING | STATUS_ASSOCIATED);
+	priv->status |= STATUS_DISASSOCIATING;
+
 }
 
 static int ipw_disassociate(void *data)
@@ -6093,8 +6111,6 @@ static int ipw_associate_network(struct 
 	 */
 	priv->channel = network->channel;
 	memcpy(priv->bssid, network->bssid, ETH_ALEN);
-	priv->status |= STATUS_ASSOCIATING;
-	priv->status &= ~STATUS_SECURITY_UPDATED;
 
 	priv->assoc_network = network;
 
@@ -6104,6 +6120,9 @@ static int ipw_associate_network(struct 
 		return err;
 	}
 
+	priv->status |= STATUS_ASSOCIATING;
+	priv->status &= ~STATUS_SECURITY_UPDATED;
+
 	IPW_DEBUG(IPW_DL_STATE, "associating: '%s' " MAC_FMT " \n",
 		  escape_essid(priv->essid, priv->essid_len),
 		  MAC_ARG(priv->bssid));