aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/nl80211.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-07-02 15:36:37 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 15:01:54 -0400
commit3dc27d25f288c923735e8f10fa8e578be896e96a (patch)
tree8bcf907a8607e1f7f8e2a4f8da30cfbc74fc3653 /net/wireless/nl80211.c
parent4244f41a040288e07d050ea64f60997c584cce9e (diff)
nl80211: limit to one pairwise cipher for associate()
In this case, only one cipher makes sense, unlike for connect() where it may be possible to have the card or driver select. No changes to mac80211 due to the way the structs are laid out -- but the loop in net/mac80211/cfg.c will degrade to just zero or one passes. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r--net/wireless/nl80211.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index aa2b3f35cc48..723512b48f2e 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3119,7 +3119,8 @@ unlock_rtnl:
3119} 3119}
3120 3120
3121static int nl80211_crypto_settings(struct genl_info *info, 3121static int nl80211_crypto_settings(struct genl_info *info,
3122 struct cfg80211_crypto_settings *settings) 3122 struct cfg80211_crypto_settings *settings,
3123 int cipher_limit)
3123{ 3124{
3124 settings->control_port = info->attrs[NL80211_ATTR_CONTROL_PORT]; 3125 settings->control_port = info->attrs[NL80211_ATTR_CONTROL_PORT];
3125 3126
@@ -3134,7 +3135,7 @@ static int nl80211_crypto_settings(struct genl_info *info,
3134 if (len % sizeof(u32)) 3135 if (len % sizeof(u32))
3135 return -EINVAL; 3136 return -EINVAL;
3136 3137
3137 if (settings->n_ciphers_pairwise > NL80211_MAX_NR_CIPHER_SUITES) 3138 if (settings->n_ciphers_pairwise > cipher_limit)
3138 return -EINVAL; 3139 return -EINVAL;
3139 3140
3140 memcpy(settings->ciphers_pairwise, data, len); 3141 memcpy(settings->ciphers_pairwise, data, len);
@@ -3247,7 +3248,7 @@ static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
3247 } 3248 }
3248 } 3249 }
3249 3250
3250 err = nl80211_crypto_settings(info, &crypto); 3251 err = nl80211_crypto_settings(info, &crypto, 1);
3251 if (!err) 3252 if (!err)
3252 err = cfg80211_mlme_assoc(rdev, dev, chan, bssid, ssid, 3253 err = cfg80211_mlme_assoc(rdev, dev, chan, bssid, ssid,
3253 ssid_len, ie, ie_len, use_mfp, 3254 ssid_len, ie, ie_len, use_mfp,
@@ -3652,7 +3653,8 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)
3652 3653
3653 connect.privacy = info->attrs[NL80211_ATTR_PRIVACY]; 3654 connect.privacy = info->attrs[NL80211_ATTR_PRIVACY];
3654 3655
3655 err = nl80211_crypto_settings(info, &connect.crypto); 3656 err = nl80211_crypto_settings(info, &connect.crypto,
3657 NL80211_MAX_NR_CIPHER_SUITES);
3656 if (err) 3658 if (err)
3657 return err; 3659 return err;
3658 rtnl_lock(); 3660 rtnl_lock();