nl80211: limit to one pairwise cipher for associate()
Johannes Berg
maintainerPATCH 1/1 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 <[email protected]>
--- net/wireless/nl80211.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
net/wireless/nl80211.c +6 -4
@@ -3119,7 +3119,8 @@ unlock_rtnl: }static int nl80211_crypto_settings (struct genl_info *info, -struct cfg80211_crypto_settings *settings) +struct cfg80211_crypto_settings *settings, +int cipher_limit) { settings->control_port = info->attrs[NL80211_ATTR_CONTROL_PORT ];
@@ -3134,7 +3135,7 @@ static int nl80211_crypto_settings(strucif (len %sizeof (u32))return -EINVAL ; -if (settings->n_ciphers_pairwise >NL80211_MAX_NR_CIPHER_SUITES ) +if (settings->n_ciphers_pairwise > cipher_limit)return -EINVAL ;memcpy (settings->ciphers_pairwise, data, len);
@@ -3250,7 +3251,7 @@ static int nl80211_associate(struct sk_bif (info->attrs[NL80211_ATTR_PREV_BSSID ]) prev_bssid =nla_data (info->attrs[NL80211_ATTR_PREV_BSSID ]); - err =nl80211_crypto_settings (info, &crypto); + err =nl80211_crypto_settings (info, &crypto,1 );if (!err) err = cfg80211_mlme_assoc(rdev, dev, chan, bssid, prev_bssid, ssid, ssid_len, ie, ie_len, use_mfp,
@@ -3655,7 +3656,8 @@ static int nl80211_connect(struct sk_buf connect.privacy = info->attrs[NL80211_ATTR_PRIVACY ]; - err =nl80211_crypto_settings (info, &connect.crypto); + err =nl80211_crypto_settings (info, &connect.crypto, +NL80211_MAX_NR_CIPHER_SUITES );if (err)return err;rtnl_lock ();
Johannes Berg
maintainerPATCH v2 1/1 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 <[email protected]>
---
Sorry, based on wrong patch.
net/wireless/nl80211.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
net/wireless/nl80211.c +6 -4
@@ -3118,7 +3118,8 @@ unlock_rtnl: }static int nl80211_crypto_settings (struct genl_info *info, -struct cfg80211_crypto_settings *settings) +struct cfg80211_crypto_settings *settings, +int cipher_limit) { settings->control_port = info->attrs[NL80211_ATTR_CONTROL_PORT ];
@@ -3133,7 +3134,7 @@ static int nl80211_crypto_settings(strucif (len %sizeof (u32))return -EINVAL ; -if (settings->n_ciphers_pairwise >NL80211_MAX_NR_CIPHER_SUITES ) +if (settings->n_ciphers_pairwise > cipher_limit)return -EINVAL ;memcpy (settings->ciphers_pairwise, data, len);
@@ -3246,7 +3247,7 @@ static int nl80211_associate(struct sk_b } } - err =nl80211_crypto_settings (info, &crypto); + err =nl80211_crypto_settings (info, &crypto,1 );if (!err) err = cfg80211_mlme_assoc(rdev, dev, chan, bssid, ssid, ssid_len, ie, ie_len, use_mfp,
@@ -3651,7 +3652,8 @@ static int nl80211_connect(struct sk_buf connect.privacy = info->attrs[NL80211_ATTR_PRIVACY ]; - err =nl80211_crypto_settings (info, &connect.crypto); + err =nl80211_crypto_settings (info, &connect.crypto, +NL80211_MAX_NR_CIPHER_SUITES );if (err)return err;rtnl_lock ();