Linux wireless drivers development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: Jouni Malinen <j@w1.fi>, linux-wireless <linux-wireless@vger.kernel.org>
Subject: [PATCH] mac80211: properly validate/translate IW_AUTH_MFP values
Date: Sun, 08 Feb 2009 14:33:19 +0100	[thread overview]
Message-ID: <1234099999.4175.123.camel@johannes.local> (raw)

Make sure nobody passes in bogus values, and translate the values
(although it isn't necessary).

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 net/mac80211/wext.c |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

--- wireless-testing.orig/net/mac80211/wext.c	2009-02-08 14:24:32.000000000 +0100
+++ wireless-testing/net/mac80211/wext.c	2009-02-08 14:29:45.000000000 +0100
@@ -946,9 +946,21 @@ static int ieee80211_ioctl_siwauth(struc
 			break;
 		}
 		if (sdata->vif.type == NL80211_IFTYPE_STATION ||
-		    sdata->vif.type == NL80211_IFTYPE_ADHOC)
-			sdata->u.sta.mfp = data->value;
-		else
+		    sdata->vif.type == NL80211_IFTYPE_ADHOC) {
+		    	switch (data->value) {
+		    	case IW_AUTH_MFP_DISABLED:
+		    		sdata->u.sta.mfp = IEEE80211_MFP_DISABLED;
+		    		break;
+		    	case IW_AUTH_MFP_OPTIONAL:
+		    		sdata->u.sta.mfp = IEEE80211_MFP_OPTIONAL;
+		    		break;
+		    	case IW_AUTH_MFP_REQUIRED:
+		    		sdata->u.sta.mfp = IEEE80211_MFP_REQUIRED;
+		    		break;
+		    	default:
+		    		ret = -EINVAL;
+		    	}
+		} else
 			ret = -EOPNOTSUPP;
 		break;
 	default:



                 reply	other threads:[~2009-02-08 13:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1234099999.4175.123.camel@johannes.local \
    --to=johannes@sipsolutions.net \
    --cc=j@w1.fi \
    --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