linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: fix races between siwessid and siwencode
@ 2008-03-05  9:40 Joonwoo Park
  2008-03-05  9:48 ` Joonwoo Park
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Joonwoo Park @ 2008-03-05  9:40 UTC (permalink / raw)
  To: linville; +Cc: Joonwoo Park, linux-wireless

resolve: http://bughost.org/bugzilla/show_bug.cgi?id=1522

The function ieee80211_ioctl_siwencode shouldn't be called if
authentication process is not completed.
This patch makes the ieee80211_ioctl_siwessid to wait for authentication
is completed.

Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
---
 net/mac80211/ieee80211_ioctl.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index 5024d37..55a29f6 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -391,6 +391,7 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev,
 	if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
 	    sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
 		int ret;
+		DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq);
 		if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) {
 			if (len > IEEE80211_MAX_SSID_LEN)
 				return -EINVAL;
@@ -405,8 +406,15 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev,
 		ret = ieee80211_sta_set_ssid(dev, ssid, len);
 		if (ret)
 			return ret;
+
+		set_bit(IEEE80211_STA_REQ_RUN, &sdata->u.sta.request);
+
 		ieee80211_sta_req_auth(dev, &sdata->u.sta);
-		return 0;
+
+		ret = wait_event_interruptible_timeout(wq,
+			!test_bit(IEEE80211_STA_REQ_RUN, &sdata->u.sta.request),
+				HZ);
+		return (ret == HZ) ? 0 : ret;
 	}
 
 	if (sdata->vif.type == IEEE80211_IF_TYPE_AP) {
-- 
1.5.4


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

end of thread, other threads:[~2008-03-10 15:07 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-05  9:40 [PATCH] mac80211: fix races between siwessid and siwencode Joonwoo Park
2008-03-05  9:48 ` Joonwoo Park
2008-03-05 13:53   ` Helge Hafting
2008-03-05 15:01     ` Tomas Winkler
2008-03-06 14:01       ` Helge Hafting
2008-03-06 14:25         ` Tomas Winkler
2008-03-06 14:30         ` Dan Williams
2008-03-09 11:52           ` Helge Hafting
2008-03-10 15:02             ` Dan Williams
2008-03-05  9:54 ` Johannes Berg
2008-03-05 11:10   ` Joonwoo Park
2008-03-05 11:17     ` Johannes Berg
2008-03-05 18:29       ` Dan Williams
2008-03-05 18:53         ` Tomas Winkler
2008-03-05 19:19           ` Dan Williams
2008-03-05 20:50             ` Tomas Winkler
2008-03-05 21:23               ` Dan Williams
2008-03-05 22:28                 ` Tomas Winkler
2008-03-05 23:35                   ` Dan Williams
2008-03-05 18:22 ` Dan Williams
2008-03-05 18:30   ` 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).