Search Linux Wireless

[PATCH] mac80211: fix races between siwessid and siwencode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux