Commit 35237fe4 authored by Ajay Singh's avatar Ajay Singh Committed by Greg Kroah-Hartman

staging: wilc1000: handle error condition in add_key() and remove auth_type variable

Added the code to return correct error code in add_key() and also removed
'auth_type' variable. Now passing diretly to function instead of using
the 'auth_type' variable.
Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Reviewed-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9c3427fd
...@@ -922,7 +922,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, ...@@ -922,7 +922,6 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
const u8 *tx_mic = NULL; const u8 *tx_mic = NULL;
u8 mode = NO_ENCRYPT; u8 mode = NO_ENCRYPT;
u8 op_mode; u8 op_mode;
enum AUTHTYPE auth_type = ANY;
struct wilc *wl; struct wilc *wl;
struct wilc_vif *vif; struct wilc_vif *vif;
...@@ -936,24 +935,24 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, ...@@ -936,24 +935,24 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
if (priv->wdev->iftype == NL80211_IFTYPE_AP) { if (priv->wdev->iftype == NL80211_IFTYPE_AP) {
wilc_wfi_cfg_copy_wep_info(priv, key_index, params); wilc_wfi_cfg_copy_wep_info(priv, key_index, params);
auth_type = OPEN_SYSTEM;
if (params->cipher == WLAN_CIPHER_SUITE_WEP40) if (params->cipher == WLAN_CIPHER_SUITE_WEP40)
mode = ENCRYPT_ENABLED | WEP; mode = ENCRYPT_ENABLED | WEP;
else else
mode = ENCRYPT_ENABLED | WEP | WEP_EXTENDED; mode = ENCRYPT_ENABLED | WEP | WEP_EXTENDED;
wilc_add_wep_key_bss_ap(vif, params->key, ret = wilc_add_wep_key_bss_ap(vif, params->key,
params->key_len, key_index, params->key_len,
mode, auth_type); key_index, mode,
OPEN_SYSTEM);
break; break;
} }
if (memcmp(params->key, priv->wep_key[key_index], if (memcmp(params->key, priv->wep_key[key_index],
params->key_len)) { params->key_len)) {
wilc_wfi_cfg_copy_wep_info(priv, key_index, params); wilc_wfi_cfg_copy_wep_info(priv, key_index, params);
wilc_add_wep_key_bss_sta(vif, params->key, ret = wilc_add_wep_key_bss_sta(vif, params->key,
params->key_len, key_index); params->key_len,
key_index);
} }
break; break;
...@@ -962,7 +961,9 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, ...@@ -962,7 +961,9 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
case WLAN_CIPHER_SUITE_CCMP: case WLAN_CIPHER_SUITE_CCMP:
if (priv->wdev->iftype == NL80211_IFTYPE_AP || if (priv->wdev->iftype == NL80211_IFTYPE_AP ||
priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) { priv->wdev->iftype == NL80211_IFTYPE_P2P_GO) {
wilc_wfi_cfg_allocate_wpa_entry(priv, key_index); ret = wilc_wfi_cfg_allocate_wpa_entry(priv, key_index);
if (ret)
return -ENOMEM;
if (params->key_len > 16 && if (params->key_len > 16 &&
params->cipher == WLAN_CIPHER_SUITE_TKIP) { params->cipher == WLAN_CIPHER_SUITE_TKIP) {
...@@ -979,16 +980,20 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, ...@@ -979,16 +980,20 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
priv->wilc_groupkey = mode; priv->wilc_groupkey = mode;
wilc_wfi_cfg_copy_wpa_info(priv->wilc_gtk[key_index], ret = wilc_wfi_cfg_copy_wpa_info(priv->wilc_gtk[key_index],
params); params);
if (ret)
return -ENOMEM;
} else { } else {
if (params->cipher == WLAN_CIPHER_SUITE_TKIP) if (params->cipher == WLAN_CIPHER_SUITE_TKIP)
mode = ENCRYPT_ENABLED | WPA | TKIP; mode = ENCRYPT_ENABLED | WPA | TKIP;
else else
mode = priv->wilc_groupkey | AES; mode = priv->wilc_groupkey | AES;
wilc_wfi_cfg_copy_wpa_info(priv->wilc_ptk[key_index], ret = wilc_wfi_cfg_copy_wpa_info(priv->wilc_ptk[key_index],
params); params);
if (ret)
return -ENOMEM;
} }
op_mode = AP_MODE; op_mode = AP_MODE;
} else { } else {
...@@ -1002,17 +1007,16 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, ...@@ -1002,17 +1007,16 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
op_mode = STATION_MODE; op_mode = STATION_MODE;
} }
if (!pairwise) { if (!pairwise)
wilc_add_rx_gtk(vif, params->key, keylen, ret = wilc_add_rx_gtk(vif, params->key, keylen,
key_index, params->seq_len, key_index, params->seq_len,
params->seq, rx_mic, params->seq, rx_mic, tx_mic,
tx_mic, op_mode, op_mode, mode);
mode); else
} else { ret = wilc_add_ptk(vif, params->key, keylen, mac_addr,
wilc_add_ptk(vif, params->key, keylen, rx_mic, tx_mic, op_mode, mode,
mac_addr, rx_mic, tx_mic, key_index);
op_mode, mode, key_index);
}
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment