From: Johannes Berg Date: Tue, 10 Feb 2009 20:25:40 +0000 (+0100) Subject: mac80211: properly validate/translate IW_AUTH_MFP values X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e4e5e2b0b83c816e581ca4671569306bcba77667;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git mac80211: properly validate/translate IW_AUTH_MFP values Make sure nobody passes in bogus values, and translate the values (although it isn't necessary). Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index bad1cfbfdf18..acd5808b87f4 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c @@ -982,9 +982,21 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev, 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: