Merge changes I649a1e89,Ia75b2f23 into msm-3.0

* changes:
  cfg80211: Validate cipher suite against supported ciphers
  cfg80211: Remove strict validation of AKM suites
This commit is contained in:
Linux Build Service Account
2012-02-04 05:23:43 -08:00
committed by QuIC Gerrit Code Review
3 changed files with 17 additions and 31 deletions

View File

@@ -408,6 +408,7 @@ void cfg80211_sme_failed_assoc(struct wireless_dev *wdev);
bool cfg80211_sme_failed_reassoc(struct wireless_dev *wdev); bool cfg80211_sme_failed_reassoc(struct wireless_dev *wdev);
/* internal helpers */ /* internal helpers */
bool cfg80211_supported_cipher_suite(struct wiphy *wiphy, u32 cipher);
int cfg80211_validate_key_settings(struct cfg80211_registered_device *rdev, int cfg80211_validate_key_settings(struct cfg80211_registered_device *rdev,
struct key_params *params, int key_idx, struct key_params *params, int key_idx,
bool pairwise, const u8 *mac_addr); bool pairwise, const u8 *mac_addr);

View File

@@ -3947,23 +3947,6 @@ static bool nl80211_valid_wpa_versions(u32 wpa_versions)
NL80211_WPA_VERSION_2)); NL80211_WPA_VERSION_2));
} }
static bool nl80211_valid_akm_suite(u32 akm)
{
return akm == WLAN_AKM_SUITE_8021X ||
akm == WLAN_AKM_SUITE_PSK;
}
static bool nl80211_valid_cipher_suite(u32 cipher)
{
return cipher == WLAN_CIPHER_SUITE_WEP40 ||
cipher == WLAN_CIPHER_SUITE_WEP104 ||
cipher == WLAN_CIPHER_SUITE_TKIP ||
cipher == WLAN_CIPHER_SUITE_CCMP ||
cipher == WLAN_CIPHER_SUITE_AES_CMAC ||
cipher == WLAN_CIPHER_SUITE_SMS4;
}
static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info) static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info)
{ {
struct cfg80211_registered_device *rdev = info->user_ptr[0]; struct cfg80211_registered_device *rdev = info->user_ptr[0];
@@ -4096,7 +4079,8 @@ static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
memcpy(settings->ciphers_pairwise, data, len); memcpy(settings->ciphers_pairwise, data, len);
for (i = 0; i < settings->n_ciphers_pairwise; i++) for (i = 0; i < settings->n_ciphers_pairwise; i++)
if (!nl80211_valid_cipher_suite( if (!cfg80211_supported_cipher_suite(
&rdev->wiphy,
settings->ciphers_pairwise[i])) settings->ciphers_pairwise[i]))
return -EINVAL; return -EINVAL;
} }
@@ -4104,7 +4088,8 @@ static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
if (info->attrs[NL80211_ATTR_CIPHER_SUITE_GROUP]) { if (info->attrs[NL80211_ATTR_CIPHER_SUITE_GROUP]) {
settings->cipher_group = settings->cipher_group =
nla_get_u32(info->attrs[NL80211_ATTR_CIPHER_SUITE_GROUP]); nla_get_u32(info->attrs[NL80211_ATTR_CIPHER_SUITE_GROUP]);
if (!nl80211_valid_cipher_suite(settings->cipher_group)) if (!cfg80211_supported_cipher_suite(&rdev->wiphy,
settings->cipher_group))
return -EINVAL; return -EINVAL;
} }
@@ -4117,7 +4102,7 @@ static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
if (info->attrs[NL80211_ATTR_AKM_SUITES]) { if (info->attrs[NL80211_ATTR_AKM_SUITES]) {
void *data; void *data;
int len, i; int len;
data = nla_data(info->attrs[NL80211_ATTR_AKM_SUITES]); data = nla_data(info->attrs[NL80211_ATTR_AKM_SUITES]);
len = nla_len(info->attrs[NL80211_ATTR_AKM_SUITES]); len = nla_len(info->attrs[NL80211_ATTR_AKM_SUITES]);
@@ -4130,10 +4115,6 @@ static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
return -EINVAL; return -EINVAL;
memcpy(settings->akm_suites, data, len); memcpy(settings->akm_suites, data, len);
for (i = 0; i < settings->n_akm_suites; i++)
if (!nl80211_valid_akm_suite(settings->akm_suites[i]))
return -EINVAL;
} }
return 0; return 0;

View File

@@ -150,12 +150,19 @@ void ieee80211_set_bitrate_flags(struct wiphy *wiphy)
set_mandatory_flags_band(wiphy->bands[band], band); set_mandatory_flags_band(wiphy->bands[band], band);
} }
bool cfg80211_supported_cipher_suite(struct wiphy *wiphy, u32 cipher)
{
int i;
for (i = 0; i < wiphy->n_cipher_suites; i++)
if (cipher == wiphy->cipher_suites[i])
return true;
return false;
}
int cfg80211_validate_key_settings(struct cfg80211_registered_device *rdev, int cfg80211_validate_key_settings(struct cfg80211_registered_device *rdev,
struct key_params *params, int key_idx, struct key_params *params, int key_idx,
bool pairwise, const u8 *mac_addr) bool pairwise, const u8 *mac_addr)
{ {
int i;
if (key_idx > 5) if (key_idx > 5)
return -EINVAL; return -EINVAL;
@@ -229,10 +236,7 @@ int cfg80211_validate_key_settings(struct cfg80211_registered_device *rdev,
} }
} }
for (i = 0; i < rdev->wiphy.n_cipher_suites; i++) if (!cfg80211_supported_cipher_suite(&rdev->wiphy, params->cipher))
if (params->cipher == rdev->wiphy.cipher_suites[i])
break;
if (i == rdev->wiphy.n_cipher_suites)
return -EINVAL; return -EINVAL;
return 0; return 0;