linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: check that ieee80211_set_power_mgmt only handles STA interfaces.
@ 2010-01-15  0:48 Benoit Papillault
  2010-01-15  0:52 ` Luis R. Rodriguez
  2010-01-15 10:17 ` Johannes Berg
  0 siblings, 2 replies; 5+ messages in thread
From: Benoit Papillault @ 2010-01-15  0:48 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Benoit Papillault

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.

Signed-off-by: Benoit Papillault <benoit.papillault@free.fr>
---
 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..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;
+
 	if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS))
 		return -EOPNOTSUPP;
 
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mac80211: check that ieee80211_set_power_mgmt only handles STA interfaces.
  2010-01-15  0:48 [PATCH] mac80211: check that ieee80211_set_power_mgmt only handles STA interfaces Benoit Papillault
@ 2010-01-15  0:52 ` Luis R. Rodriguez
  2010-01-15  1:08   ` Benoit PAPILLAULT
  2010-01-15 10:17 ` Johannes Berg
  1 sibling, 1 reply; 5+ messages in thread
From: Luis R. Rodriguez @ 2010-01-15  0:52 UTC (permalink / raw)
  To: Benoit Papillault; +Cc: johannes, linux-wireless

On Thu, Jan 14, 2010 at 4:48 PM, Benoit Papillault
<benoit.papillault@free.fr> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mac80211: check that ieee80211_set_power_mgmt only  handles STA interfaces.
  2010-01-15  0:52 ` Luis R. Rodriguez
@ 2010-01-15  1:08   ` Benoit PAPILLAULT
  0 siblings, 0 replies; 5+ messages in thread
From: Benoit PAPILLAULT @ 2010-01-15  1:08 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: johannes, linux-wireless

Luis R. Rodriguez a écrit :
> On Thu, Jan 14, 2010 at 4:48 PM, Benoit Papillault
> <benoit.papillault@free.fr> 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mac80211: check that ieee80211_set_power_mgmt only handles STA interfaces.
  2010-01-15  0:48 [PATCH] mac80211: check that ieee80211_set_power_mgmt only handles STA interfaces Benoit Papillault
  2010-01-15  0:52 ` Luis R. Rodriguez
@ 2010-01-15 10:17 ` Johannes Berg
  1 sibling, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2010-01-15 10:17 UTC (permalink / raw)
  To: Benoit Papillault; +Cc: linux-wireless

[-- Attachment #1: Type: text/plain, Size: 898 bytes --]

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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] mac80211: check that ieee80211_set_power_mgmt only handles STA interfaces.
@ 2010-01-15 11:21 Benoit Papillault
  0 siblings, 0 replies; 5+ messages in thread
From: Benoit Papillault @ 2010-01-15 11:21 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Benoit Papillault, stable

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>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-01-15 20:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-15  0:48 [PATCH] mac80211: check that ieee80211_set_power_mgmt only handles STA interfaces Benoit Papillault
2010-01-15  0:52 ` Luis R. Rodriguez
2010-01-15  1:08   ` Benoit PAPILLAULT
2010-01-15 10:17 ` Johannes Berg
  -- strict thread matches above, loose matches on Subject: below --
2010-01-15 11:21 Benoit Papillault

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).