Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] mac80211: properly validate/translate IW_AUTH_MFP values
@ 2009-02-08 13:33 Johannes Berg
  0 siblings, 0 replies; only message in thread
From: Johannes Berg @ 2009-02-08 13:33 UTC (permalink / raw)
  To: John Linville; +Cc: Jouni Malinen, linux-wireless

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:



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-02-08 13:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-08 13:33 [PATCH] mac80211: properly validate/translate IW_AUTH_MFP values Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox