diff options
author | Johannes Berg <johannes.berg@intel.com> | 2014-01-22 04:05:27 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-02-04 15:48:16 -0500 |
commit | 1ff79dfa37d36c16d91eeeebb8cc3dcba32c2c16 (patch) | |
tree | 6400fb9a5f7470a37afc9fac5d8b9e07b2c23f39 /net/wireless | |
parent | c782bf8caae59a6cdd17ed1b99c126167dae49b2 (diff) |
nl80211: check channel switch validity better
Before allowing userspace to initiate a channel switch, check
that it's actually connected in some sense. Also use a more
appropriate error code for the not connected case.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/nl80211.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index a3515ebbd32b..d0f69f5523e8 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -5771,10 +5771,15 @@ static int nl80211_channel_switch(struct sk_buff *skb, struct genl_info *info) | |||
5771 | 5771 | ||
5772 | /* useless if AP is not running */ | 5772 | /* useless if AP is not running */ |
5773 | if (!wdev->beacon_interval) | 5773 | if (!wdev->beacon_interval) |
5774 | return -EINVAL; | 5774 | return -ENOTCONN; |
5775 | break; | 5775 | break; |
5776 | case NL80211_IFTYPE_ADHOC: | 5776 | case NL80211_IFTYPE_ADHOC: |
5777 | if (!wdev->ssid_len) | ||
5778 | return -ENOTCONN; | ||
5779 | break; | ||
5777 | case NL80211_IFTYPE_MESH_POINT: | 5780 | case NL80211_IFTYPE_MESH_POINT: |
5781 | if (!wdev->mesh_id_len) | ||
5782 | return -ENOTCONN; | ||
5778 | break; | 5783 | break; |
5779 | default: | 5784 | default: |
5780 | return -EOPNOTSUPP; | 5785 | return -EOPNOTSUPP; |