linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nl80211: check channel switch validity better
@ 2014-01-22  9:16 Johannes Berg
  2014-01-22 18:02 ` Thomas Pedersen
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2014-01-22  9:16 UTC (permalink / raw)
  To: linux-wireless

From: Johannes Berg <johannes.berg@intel.com>

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>
---
 net/wireless/nl80211.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 6e78c62..0c2ef08 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -5799,10 +5799,15 @@ static int nl80211_channel_switch(struct sk_buff *skb, struct genl_info *info)
 
 		/* useless if AP is not running */
 		if (!wdev->beacon_interval)
-			return -EINVAL;
+			return -ENOTCONN;
 		break;
 	case NL80211_IFTYPE_ADHOC:
+		if (!wdev->ssid_len)
+			return -ENOTCONN;
+		break;
 	case NL80211_IFTYPE_MESH_POINT:
+		if (!wdev->mesh_id_len)
+			return -ENOTCONN;
 		break;
 	default:
 		return -EOPNOTSUPP;
-- 
1.8.5.1




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

* Re: [PATCH] nl80211: check channel switch validity better
  2014-01-22  9:16 [PATCH] nl80211: check channel switch validity better Johannes Berg
@ 2014-01-22 18:02 ` Thomas Pedersen
  2014-01-22 18:28   ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Pedersen @ 2014-01-22 18:02 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

On Wed, Jan 22, 2014 at 1:16 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> 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>
> ---
>  net/wireless/nl80211.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
> index 6e78c62..0c2ef08 100644
> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -5799,10 +5799,15 @@ static int nl80211_channel_switch(struct sk_buff *skb, struct genl_info *info)
>
>                 /* useless if AP is not running */
>                 if (!wdev->beacon_interval)
> -                       return -EINVAL;
> +                       return -ENOTCONN;
>                 break;
>         case NL80211_IFTYPE_ADHOC:
> +               if (!wdev->ssid_len)
> +                       return -ENOTCONN;
> +               break;
>         case NL80211_IFTYPE_MESH_POINT:
> +               if (!wdev->mesh_id_len)
> +                       return -ENOTCONN;

Hmmm. I'm pretty sure there are some users which set the channel prior
to mesh join. This would break that and only allow sending the channel
with mesh join?

Thomas

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

* Re: [PATCH] nl80211: check channel switch validity better
  2014-01-22 18:02 ` Thomas Pedersen
@ 2014-01-22 18:28   ` Johannes Berg
  2014-01-22 18:46     ` Thomas Pedersen
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2014-01-22 18:28 UTC (permalink / raw)
  To: Thomas Pedersen; +Cc: linux-wireless

On Wed, 2014-01-22 at 10:02 -0800, Thomas Pedersen wrote:

> > --- a/net/wireless/nl80211.c
> > +++ b/net/wireless/nl80211.c
> > @@ -5799,10 +5799,15 @@ static int nl80211_channel_switch(struct sk_buff *skb, struct genl_info *info)

> >         case NL80211_IFTYPE_MESH_POINT:
> > +               if (!wdev->mesh_id_len)
> > +                       return -ENOTCONN;
> 
> Hmmm. I'm pretty sure there are some users which set the channel prior
> to mesh join. This would break that and only allow sending the channel
> with mesh join?

I don't think channel_switch() is invoked for that? That's done only for
run-time switching of the channel with CSA etc.

johannes


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

* Re: [PATCH] nl80211: check channel switch validity better
  2014-01-22 18:28   ` Johannes Berg
@ 2014-01-22 18:46     ` Thomas Pedersen
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Pedersen @ 2014-01-22 18:46 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

On Wed, Jan 22, 2014 at 10:28 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Wed, 2014-01-22 at 10:02 -0800, Thomas Pedersen wrote:
>
>> > --- a/net/wireless/nl80211.c
>> > +++ b/net/wireless/nl80211.c
>> > @@ -5799,10 +5799,15 @@ static int nl80211_channel_switch(struct sk_buff *skb, struct genl_info *info)
>
>> >         case NL80211_IFTYPE_MESH_POINT:
>> > +               if (!wdev->mesh_id_len)
>> > +                       return -ENOTCONN;
>>
>> Hmmm. I'm pretty sure there are some users which set the channel prior
>> to mesh join. This would break that and only allow sending the channel
>> with mesh join?
>
> I don't think channel_switch() is invoked for that? That's done only for
> run-time switching of the channel with CSA etc.

Oh right, that was a special case then.

Thanks,
Thomas

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

end of thread, other threads:[~2014-01-22 18:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-22  9:16 [PATCH] nl80211: check channel switch validity better Johannes Berg
2014-01-22 18:02 ` Thomas Pedersen
2014-01-22 18:28   ` Johannes Berg
2014-01-22 18:46     ` Thomas Pedersen

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