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: [email protected]
Signed-off-by: Benoit Papillault <[email protected]>
---
net/mac80211/cfg.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 8286df5..2287d31 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1382,6 +1382,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;
--
1.6.3.3
On Thu, Jan 14, 2010 at 4:48 PM, Benoit Papillault
<[email protected]> wrote:
> 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 IBSS) will result in a
> oops.
Is this path even possible at this point? Is this a stable fix?
Luis
Luis R. Rodriguez a écrit :
> On Thu, Jan 14, 2010 at 4:48 PM, Benoit Papillault
> <[email protected]> wrote:
>> 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 IBSS) will result in a
>> oops.
>
> Is this path even possible at this point? Is this a stable fix?
>
> Luis
>
This is the case if you create a monitor interface (I wonder why it did
not notice before however). I think we should return -EOPNOTSUPP instead
of 0 (otherwise iwconfig shows "Power management:on" on monitor
interface). As such, this is a stable fix.
Do i need to send an updated patch?
Regards,
Benoit
On Fri, 2010-01-15 at 01:48 +0100, Benoit Papillault wrote:
> 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 IBSS) will result in a
> oops.
Odd that nobody else ever saw a problem, is everybody running cards that
don't do power management?
> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
> index 8286df5..c9de4e3 100644
> --- a/net/mac80211/cfg.c
> +++ b/net/mac80211/cfg.c
> @@ -1382,6 +1382,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 0;
You want -EOPNOTSUPP here, and cc stable.
johannes