Skip to content

Commit 4490526

Browse files
committed
nl80211: don't expose wdev->ssid for most interfaces
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: b84e7a0 ("nl80211: send the NL80211_ATTR_SSID in nl80211_send_iface()") Signed-off-by: Johannes Berg <[email protected]>
1 parent 34f11cd commit 4490526

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

net/wireless/nl80211.c

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2605,10 +2605,32 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag
26052605
goto nla_put_failure;
26062606
}
26072607

2608-
if (wdev->ssid_len) {
2609-
if (nla_put(msg, NL80211_ATTR_SSID, wdev->ssid_len, wdev->ssid))
2608+
wdev_lock(wdev);
2609+
switch (wdev->iftype) {
2610+
case NL80211_IFTYPE_AP:
2611+
if (wdev->ssid_len &&
2612+
nla_put(msg, NL80211_ATTR_SSID, wdev->ssid_len, wdev->ssid))
26102613
goto nla_put_failure;
2614+
break;
2615+
case NL80211_IFTYPE_STATION:
2616+
case NL80211_IFTYPE_P2P_CLIENT:
2617+
case NL80211_IFTYPE_ADHOC: {
2618+
const u8 *ssid_ie;
2619+
if (!wdev->current_bss)
2620+
break;
2621+
ssid_ie = ieee80211_bss_get_ie(&wdev->current_bss->pub,
2622+
WLAN_EID_SSID);
2623+
if (!ssid_ie)
2624+
break;
2625+
if (nla_put(msg, NL80211_ATTR_SSID, ssid_ie[1], ssid_ie + 2))
2626+
goto nla_put_failure;
2627+
break;
2628+
}
2629+
default:
2630+
/* nothing */
2631+
break;
26112632
}
2633+
wdev_unlock(wdev);
26122634

26132635
genlmsg_end(msg, hdr);
26142636
return 0;

0 commit comments

Comments
 (0)