]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mac80211: check that ieee80211_set_power_mgmt only handles STA interfaces.
authorBenoit Papillault <benoit.papillault@free.fr>
Fri, 15 Jan 2010 11:21:37 +0000 (12:21 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 28 Jan 2010 23:02:37 +0000 (15:02 -0800)
commit e5de30c9bf4a39db9f54c4a373470ce65881ade0 upstream.

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.

Signed-off-by: Benoit Papillault <benoit.papillault@free.fr>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/mac80211/cfg.c

index cca675e25363ec984a607c881bc7349c9ab6281a..fe2d3f8c5ae7b6fbd8be30c13c4b56f65f735629 100644 (file)
@@ -1306,6 +1306,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;