Linux wireless drivers development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless <linux-wireless@vger.kernel.org>
Subject: [PATCH] mac80211: refuse invalid interface configuration
Date: Tue, 16 Sep 2008 20:32:04 +0200	[thread overview]
Message-ID: <1221589924.8916.52.camel@johannes.berg> (raw)

Refuse setting mesh_id on non-mesh or monitor flags on non-monitor
interfaces.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 net/mac80211/cfg.c |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

--- everything.orig/net/mac80211/cfg.c	2008-09-16 20:24:53.000000000 +0200
+++ everything/net/mac80211/cfg.c	2008-09-16 20:28:14.000000000 +0200
@@ -105,14 +105,21 @@ static int ieee80211_change_iface(struct
 	if (netif_running(sdata->dev))
 		return -EBUSY;
 
-	if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len)
-		ieee80211_sdata_set_mesh_id(sdata,
-					    params->mesh_id_len,
-					    params->mesh_id);
+	if (params->mesh_id_len) {
+		if (ieee80211_vif_is_mesh(&sdata->vif))
+			ieee80211_sdata_set_mesh_id(sdata,
+						    params->mesh_id_len,
+						    params->mesh_id);
+		else
+			return -EINVAL;
+	}
 
-	if (sdata->vif.type != NL80211_IFTYPE_MONITOR || !flags)
+	if (!flags)
 		return 0;
 
+	if (sdata->vif.type != NL80211_IFTYPE_MONITOR)
+		return -EINVAL;
+
 	sdata->u.mntr_flags = *flags;
 	return 0;
 }



             reply	other threads:[~2008-09-16 18:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-16 18:32 Johannes Berg [this message]
2008-09-16 18:34 ` [PATCH] mac80211: refuse invalid interface configuration Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1221589924.8916.52.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox