diff options
Diffstat (limited to 'net/wireless/nl80211.c')
| -rw-r--r-- | net/wireless/nl80211.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 98fa8eb6cc4b..cea338150d05 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
| @@ -3461,9 +3461,6 @@ static int nl80211_start_sched_scan(struct sk_buff *skb, | |||
| 3461 | if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE])) | 3461 | if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE])) |
| 3462 | return -EINVAL; | 3462 | return -EINVAL; |
| 3463 | 3463 | ||
| 3464 | if (rdev->sched_scan_req) | ||
| 3465 | return -EINPROGRESS; | ||
| 3466 | |||
| 3467 | if (!info->attrs[NL80211_ATTR_SCHED_SCAN_INTERVAL]) | 3464 | if (!info->attrs[NL80211_ATTR_SCHED_SCAN_INTERVAL]) |
| 3468 | return -EINVAL; | 3465 | return -EINVAL; |
| 3469 | 3466 | ||
| @@ -3502,12 +3499,21 @@ static int nl80211_start_sched_scan(struct sk_buff *skb, | |||
| 3502 | if (ie_len > wiphy->max_scan_ie_len) | 3499 | if (ie_len > wiphy->max_scan_ie_len) |
| 3503 | return -EINVAL; | 3500 | return -EINVAL; |
| 3504 | 3501 | ||
| 3502 | mutex_lock(&rdev->sched_scan_mtx); | ||
| 3503 | |||
| 3504 | if (rdev->sched_scan_req) { | ||
| 3505 | err = -EINPROGRESS; | ||
| 3506 | goto out; | ||
| 3507 | } | ||
| 3508 | |||
| 3505 | request = kzalloc(sizeof(*request) | 3509 | request = kzalloc(sizeof(*request) |
| 3506 | + sizeof(*request->ssids) * n_ssids | 3510 | + sizeof(*request->ssids) * n_ssids |
| 3507 | + sizeof(*request->channels) * n_channels | 3511 | + sizeof(*request->channels) * n_channels |
| 3508 | + ie_len, GFP_KERNEL); | 3512 | + ie_len, GFP_KERNEL); |
| 3509 | if (!request) | 3513 | if (!request) { |
| 3510 | return -ENOMEM; | 3514 | err = -ENOMEM; |
| 3515 | goto out; | ||
| 3516 | } | ||
| 3511 | 3517 | ||
| 3512 | if (n_ssids) | 3518 | if (n_ssids) |
| 3513 | request->ssids = (void *)&request->channels[n_channels]; | 3519 | request->ssids = (void *)&request->channels[n_channels]; |
| @@ -3605,6 +3611,7 @@ static int nl80211_start_sched_scan(struct sk_buff *skb, | |||
| 3605 | out_free: | 3611 | out_free: |
| 3606 | kfree(request); | 3612 | kfree(request); |
| 3607 | out: | 3613 | out: |
| 3614 | mutex_unlock(&rdev->sched_scan_mtx); | ||
| 3608 | return err; | 3615 | return err; |
| 3609 | } | 3616 | } |
| 3610 | 3617 | ||
| @@ -3612,12 +3619,17 @@ static int nl80211_stop_sched_scan(struct sk_buff *skb, | |||
| 3612 | struct genl_info *info) | 3619 | struct genl_info *info) |
| 3613 | { | 3620 | { |
| 3614 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | 3621 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
| 3622 | int err; | ||
| 3615 | 3623 | ||
| 3616 | if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN) || | 3624 | if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN) || |
| 3617 | !rdev->ops->sched_scan_stop) | 3625 | !rdev->ops->sched_scan_stop) |
| 3618 | return -EOPNOTSUPP; | 3626 | return -EOPNOTSUPP; |
| 3619 | 3627 | ||
| 3620 | return __cfg80211_stop_sched_scan(rdev, false); | 3628 | mutex_lock(&rdev->sched_scan_mtx); |
| 3629 | err = __cfg80211_stop_sched_scan(rdev, false); | ||
| 3630 | mutex_unlock(&rdev->sched_scan_mtx); | ||
| 3631 | |||
| 3632 | return err; | ||
| 3621 | } | 3633 | } |
| 3622 | 3634 | ||
| 3623 | static int nl80211_send_bss(struct sk_buff *msg, u32 pid, u32 seq, int flags, | 3635 | static int nl80211_send_bss(struct sk_buff *msg, u32 pid, u32 seq, int flags, |
| @@ -6463,7 +6475,8 @@ void nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev, | |||
| 6463 | if (addr) | 6475 | if (addr) |
| 6464 | NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr); | 6476 | NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr); |
| 6465 | NLA_PUT_U32(msg, NL80211_ATTR_KEY_TYPE, key_type); | 6477 | NLA_PUT_U32(msg, NL80211_ATTR_KEY_TYPE, key_type); |
| 6466 | NLA_PUT_U8(msg, NL80211_ATTR_KEY_IDX, key_id); | 6478 | if (key_id != -1) |
| 6479 | NLA_PUT_U8(msg, NL80211_ATTR_KEY_IDX, key_id); | ||
| 6467 | if (tsc) | 6480 | if (tsc) |
| 6468 | NLA_PUT(msg, NL80211_ATTR_KEY_SEQ, 6, tsc); | 6481 | NLA_PUT(msg, NL80211_ATTR_KEY_SEQ, 6, tsc); |
| 6469 | 6482 | ||
