From: Jouni Malinen Date: Tue, 29 Mar 2016 10:53:28 +0000 (+0300) Subject: cfg80211: Allow reassociation to be requested with internal SME X-Git-Tag: v4.7-rc1~154^2~326^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4ce2bd9c4c1dfb416206ff1ad5283f6d24af4031;p=platform%2Fkernel%2Flinux-exynos.git cfg80211: Allow reassociation to be requested with internal SME If the user space issues a NL80211_CMD_CONNECT with NL80211_ATTR_PREV_BSSID when there is already a connection, allow this to proceed as a reassociation instead of rejecting the new connect command with EALREADY. Signed-off-by: Jouni Malinen [validate prev_bssid] Signed-off-by: Johannes Berg --- diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 4f89e2d..4f45a29 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -8151,7 +8151,8 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) } wdev_lock(dev->ieee80211_ptr); - err = cfg80211_connect(rdev, dev, &connect, connkeys, NULL); + err = cfg80211_connect(rdev, dev, &connect, connkeys, + connect.prev_bssid); wdev_unlock(dev->ieee80211_ptr); if (err) kzfree(connkeys); diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 65882d2..1fba416 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c @@ -492,8 +492,18 @@ static int cfg80211_sme_connect(struct wireless_dev *wdev, if (!rdev->ops->auth || !rdev->ops->assoc) return -EOPNOTSUPP; - if (wdev->current_bss) - return -EALREADY; + if (wdev->current_bss) { + if (!prev_bssid) + return -EALREADY; + if (prev_bssid && + !ether_addr_equal(prev_bssid, wdev->current_bss->pub.bssid)) + return -ENOTCONN; + cfg80211_unhold_bss(wdev->current_bss); + cfg80211_put_bss(wdev->wiphy, &wdev->current_bss->pub); + wdev->current_bss = NULL; + + cfg80211_sme_free(wdev); + } if (WARN_ON(wdev->conn)) return -EINPROGRESS;