diff options
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/nl80211.c | 4 | ||||
-rw-r--r-- | net/wireless/scan.c | 43 |
2 files changed, 26 insertions, 21 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index ec83f413a7ed..88a565f130a5 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -3406,12 +3406,12 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) | |||
3406 | i = 0; | 3406 | i = 0; |
3407 | if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) { | 3407 | if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) { |
3408 | nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], tmp) { | 3408 | nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], tmp) { |
3409 | request->ssids[i].ssid_len = nla_len(attr); | ||
3409 | if (request->ssids[i].ssid_len > IEEE80211_MAX_SSID_LEN) { | 3410 | if (request->ssids[i].ssid_len > IEEE80211_MAX_SSID_LEN) { |
3410 | err = -EINVAL; | 3411 | err = -EINVAL; |
3411 | goto out_free; | 3412 | goto out_free; |
3412 | } | 3413 | } |
3413 | memcpy(request->ssids[i].ssid, nla_data(attr), nla_len(attr)); | 3414 | memcpy(request->ssids[i].ssid, nla_data(attr), nla_len(attr)); |
3414 | request->ssids[i].ssid_len = nla_len(attr); | ||
3415 | i++; | 3415 | i++; |
3416 | } | 3416 | } |
3417 | } | 3417 | } |
@@ -3572,6 +3572,7 @@ static int nl80211_start_sched_scan(struct sk_buff *skb, | |||
3572 | if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) { | 3572 | if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) { |
3573 | nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], | 3573 | nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], |
3574 | tmp) { | 3574 | tmp) { |
3575 | request->ssids[i].ssid_len = nla_len(attr); | ||
3575 | if (request->ssids[i].ssid_len > | 3576 | if (request->ssids[i].ssid_len > |
3576 | IEEE80211_MAX_SSID_LEN) { | 3577 | IEEE80211_MAX_SSID_LEN) { |
3577 | err = -EINVAL; | 3578 | err = -EINVAL; |
@@ -3579,7 +3580,6 @@ static int nl80211_start_sched_scan(struct sk_buff *skb, | |||
3579 | } | 3580 | } |
3580 | memcpy(request->ssids[i].ssid, nla_data(attr), | 3581 | memcpy(request->ssids[i].ssid, nla_data(attr), |
3581 | nla_len(attr)); | 3582 | nla_len(attr)); |
3582 | request->ssids[i].ssid_len = nla_len(attr); | ||
3583 | i++; | 3583 | i++; |
3584 | } | 3584 | } |
3585 | } | 3585 | } |
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 73a441d237b5..7a6c67667d70 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -267,13 +267,35 @@ static bool is_bss(struct cfg80211_bss *a, | |||
267 | return memcmp(ssidie + 2, ssid, ssid_len) == 0; | 267 | return memcmp(ssidie + 2, ssid, ssid_len) == 0; |
268 | } | 268 | } |
269 | 269 | ||
270 | static bool is_mesh_bss(struct cfg80211_bss *a) | ||
271 | { | ||
272 | const u8 *ie; | ||
273 | |||
274 | if (!WLAN_CAPABILITY_IS_STA_BSS(a->capability)) | ||
275 | return false; | ||
276 | |||
277 | ie = cfg80211_find_ie(WLAN_EID_MESH_ID, | ||
278 | a->information_elements, | ||
279 | a->len_information_elements); | ||
280 | if (!ie) | ||
281 | return false; | ||
282 | |||
283 | ie = cfg80211_find_ie(WLAN_EID_MESH_CONFIG, | ||
284 | a->information_elements, | ||
285 | a->len_information_elements); | ||
286 | if (!ie) | ||
287 | return false; | ||
288 | |||
289 | return true; | ||
290 | } | ||
291 | |||
270 | static bool is_mesh(struct cfg80211_bss *a, | 292 | static bool is_mesh(struct cfg80211_bss *a, |
271 | const u8 *meshid, size_t meshidlen, | 293 | const u8 *meshid, size_t meshidlen, |
272 | const u8 *meshcfg) | 294 | const u8 *meshcfg) |
273 | { | 295 | { |
274 | const u8 *ie; | 296 | const u8 *ie; |
275 | 297 | ||
276 | if (!WLAN_CAPABILITY_IS_MBSS(a->capability)) | 298 | if (!WLAN_CAPABILITY_IS_STA_BSS(a->capability)) |
277 | return false; | 299 | return false; |
278 | 300 | ||
279 | ie = cfg80211_find_ie(WLAN_EID_MESH_ID, | 301 | ie = cfg80211_find_ie(WLAN_EID_MESH_ID, |
@@ -311,7 +333,7 @@ static int cmp_bss(struct cfg80211_bss *a, | |||
311 | if (a->channel != b->channel) | 333 | if (a->channel != b->channel) |
312 | return b->channel->center_freq - a->channel->center_freq; | 334 | return b->channel->center_freq - a->channel->center_freq; |
313 | 335 | ||
314 | if (WLAN_CAPABILITY_IS_MBSS(a->capability | b->capability)) { | 336 | if (is_mesh_bss(a) && is_mesh_bss(b)) { |
315 | r = cmp_ies(WLAN_EID_MESH_ID, | 337 | r = cmp_ies(WLAN_EID_MESH_ID, |
316 | a->information_elements, | 338 | a->information_elements, |
317 | a->len_information_elements, | 339 | a->len_information_elements, |
@@ -457,7 +479,6 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, | |||
457 | struct cfg80211_internal_bss *res) | 479 | struct cfg80211_internal_bss *res) |
458 | { | 480 | { |
459 | struct cfg80211_internal_bss *found = NULL; | 481 | struct cfg80211_internal_bss *found = NULL; |
460 | const u8 *meshid, *meshcfg; | ||
461 | 482 | ||
462 | /* | 483 | /* |
463 | * The reference to "res" is donated to this function. | 484 | * The reference to "res" is donated to this function. |
@@ -470,22 +491,6 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, | |||
470 | 491 | ||
471 | res->ts = jiffies; | 492 | res->ts = jiffies; |
472 | 493 | ||
473 | if (WLAN_CAPABILITY_IS_MBSS(res->pub.capability)) { | ||
474 | /* must be mesh, verify */ | ||
475 | meshid = cfg80211_find_ie(WLAN_EID_MESH_ID, | ||
476 | res->pub.information_elements, | ||
477 | res->pub.len_information_elements); | ||
478 | meshcfg = cfg80211_find_ie(WLAN_EID_MESH_CONFIG, | ||
479 | res->pub.information_elements, | ||
480 | res->pub.len_information_elements); | ||
481 | if (!meshid || !meshcfg || | ||
482 | meshcfg[1] != sizeof(struct ieee80211_meshconf_ie)) { | ||
483 | /* bogus mesh */ | ||
484 | kref_put(&res->ref, bss_release); | ||
485 | return NULL; | ||
486 | } | ||
487 | } | ||
488 | |||
489 | spin_lock_bh(&dev->bss_lock); | 494 | spin_lock_bh(&dev->bss_lock); |
490 | 495 | ||
491 | found = rb_find_bss(dev, res); | 496 | found = rb_find_bss(dev, res); |