summaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
authorBenoit Papillault <benoit.papillault@free.fr>2010-01-15 12:21:37 +0100
committerJohn W. Linville <linville@tuxdriver.com>2010-01-15 16:20:22 -0500
commite5de30c9bf4a39db9f54c4a373470ce65881ade0 (patch)
tree9eaa6e67bdf770ccf6c98497f3a2dec2778fa4db /net/mac80211/cfg.c
parent5f6120335c701ba07d5151206071f4d6ccaa684f (diff)
mac80211: check that ieee80211_set_power_mgmt only handles STA interfaces.
ieee80211_set_power_mgmt is meant for STA interfaces only. Moreover, since sdata->u.mgd.mtx is only initialized for STA interfaces, using this code for any other type of interface (like creating a monitor interface) will result in a oops. Cc: stable@kernel.org Signed-off-by: Benoit Papillault <benoit.papillault@free.fr> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r--net/mac80211/cfg.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 6dc3579c0ac..9ae1a4760b5 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1331,6 +1331,9 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
struct ieee80211_conf *conf = &local->hw.conf;
+ if (sdata->vif.type != NL80211_IFTYPE_STATION)
+ return -EOPNOTSUPP;
+
if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS))
return -EOPNOTSUPP;