diff options
| author | Johannes Berg <johannes.berg@intel.com> | 2017-10-17 21:56:01 +0200 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2019-05-03 19:26:41 +0200 |
| commit | 8418ff5f5da2b1b181c7e40d3876490a20d017bd (patch) | |
| tree | bf1c558e1b892b6d87e2450bf0361b4dc287ab6a | |
| parent | e139d15e1d562562a04e3db3aff2468e5a4a6307 (diff) | |
nl80211: don't expose wdev->ssid for most interfaces
commit 44905265bc155e0237c76c25bf5ddf740d85a8f2 upstream.
For mesh, this is simply wrong - there's no SSID, only the
mesh ID, so don't expose it at all.
For (P2P) client, it's wrong, because it exposes an internal
value that's only used when certain APIs are used.
For AP, it's actually the only correct case, so leave that.
All other interface types shouldn't be setting this anyway,
so there it won't change anything.
Fixes: b84e7a05f619 ("nl80211: send the NL80211_ATTR_SSID in nl80211_send_iface()")
Change-Id: I71aa50fc03d401264fb19bf83da3b253f157ad72
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
| -rw-r--r-- | net/wireless/nl80211.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 7db8cc634..8da7db8fb 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -2253,10 +2253,32 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag } } - if (wdev->ssid_len) { - if (nla_put(msg, NL80211_ATTR_SSID, wdev->ssid_len, wdev->ssid)) + wdev_lock(wdev); + switch (wdev->iftype) { + case NL80211_IFTYPE_AP: + if (wdev->ssid_len && + nla_put(msg, NL80211_ATTR_SSID, wdev->ssid_len, wdev->ssid)) goto nla_put_failure; + break; + case NL80211_IFTYPE_STATION: + case NL80211_IFTYPE_P2P_CLIENT: + case NL80211_IFTYPE_ADHOC: { + const u8 *ssid_ie; + if (!wdev->current_bss) + break; + ssid_ie = ieee80211_bss_get_ie(&wdev->current_bss->pub, + WLAN_EID_SSID); + if (!ssid_ie) + break; + if (nla_put(msg, NL80211_ATTR_SSID, ssid_ie[1], ssid_ie + 2)) + goto nla_put_failure; + break; + } + default: + /* nothing */ + break; } + wdev_unlock(wdev); return genlmsg_end(msg, hdr); |
