From: Shanyu Zhao <shanyu.zhao@xxxxxxxxx> The cfg80211's SIOCSIWAP function is broken, the reason is we cannot get the correct bss with previously set ssid. Need to clear it by setting ssid_len to 0 in cfg80211_mgd_wext_siwap() and fix other places accordingly. Cc: stable@xxxxxxxxxx Signed-off-by: Shanyu Zhao <shanyu.zhao@xxxxxxxxx> --- v2: Adding Cc to stable@xxxxxxxxxx --- net/wireless/sme.c | 9 +++++++-- net/wireless/wext-sme.c | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 745c37e..51c3cdb 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c @@ -779,10 +779,15 @@ int __cfg80211_connect(struct cfg80211_registered_device *rdev, wdev->conn->auto_auth = false; } - memcpy(wdev->ssid, connect->ssid, connect->ssid_len); + /* make sure it can connect if only bssid is provided */ wdev->ssid_len = connect->ssid_len; - wdev->conn->params.ssid = wdev->ssid; wdev->conn->params.ssid_len = connect->ssid_len; + if (connect->ssid_len) { + memcpy(wdev->ssid, connect->ssid, connect->ssid_len); + wdev->conn->params.ssid = wdev->ssid; + } + else + wdev->conn->params.ssid = NULL; /* see if we have the bss already */ bss = cfg80211_get_conn_bss(wdev); diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c index 5615a88..eede356 100644 --- a/net/wireless/wext-sme.c +++ b/net/wireless/wext-sme.c @@ -34,7 +34,7 @@ int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev, wdev->wext.connect.privacy = true; } - if (!wdev->wext.connect.ssid_len) + if (!wdev->wext.connect.ssid_len && !wdev->wext.connect.bssid) return 0; if (wdev->wext.keys) { @@ -280,6 +280,7 @@ int cfg80211_mgd_wext_siwap(struct net_device *dev, if (bssid) { memcpy(wdev->wext.bssid, bssid, ETH_ALEN); wdev->wext.connect.bssid = wdev->wext.bssid; + wdev->wext.connect.ssid_len = 0; } else wdev->wext.connect.bssid = NULL; -- 1.6.0.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