Skip to content

Commit 0b59f10

Browse files
Malcolm Priestleygregkh
authored andcommitted
staging: vt6656: Fix pairwise key entry save.
The problem is that the group key was saved as VNT_KEY_DEFAULTKEY was over written by the VNT_KEY_GROUP_ADDRESS index. mac80211 could not clear the mac_addr in the default key. The VNT_KEY_DEFAULTKEY is not necesscary so remove it and set as VNT_KEY_GROUP_ADDRESS. mac80211 can clear any key using vnt_mac_disable_keyentry. Fixes: f9ef05c ("staging: vt6656: Fix pairwise key for non station modes") Cc: stable <[email protected]> Signed-off-by: Malcolm Priestley <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 0905774 commit 0b59f10

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

drivers/staging/vt6656/key.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ static int vnt_set_keymode(struct ieee80211_hw *hw, u8 *mac_addr,
8383
case VNT_KEY_PAIRWISE:
8484
key_mode |= mode;
8585
key_inx = 4;
86-
/* Don't save entry for pairwise key for station mode */
87-
if (priv->op_mode == NL80211_IFTYPE_STATION)
88-
clear_bit(entry, &priv->key_entry_inuse);
8986
break;
9087
default:
9188
return -EINVAL;
@@ -109,7 +106,6 @@ static int vnt_set_keymode(struct ieee80211_hw *hw, u8 *mac_addr,
109106
int vnt_set_keys(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
110107
struct ieee80211_vif *vif, struct ieee80211_key_conf *key)
111108
{
112-
struct ieee80211_bss_conf *conf = &vif->bss_conf;
113109
struct vnt_private *priv = hw->priv;
114110
u8 *mac_addr = NULL;
115111
u8 key_dec_mode = 0;
@@ -154,16 +150,12 @@ int vnt_set_keys(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
154150
return -EOPNOTSUPP;
155151
}
156152

157-
if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) {
153+
if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE)
158154
vnt_set_keymode(hw, mac_addr, key, VNT_KEY_PAIRWISE,
159155
key_dec_mode, true);
160-
} else {
161-
vnt_set_keymode(hw, mac_addr, key, VNT_KEY_DEFAULTKEY,
156+
else
157+
vnt_set_keymode(hw, mac_addr, key, VNT_KEY_GROUP_ADDRESS,
162158
key_dec_mode, true);
163159

164-
vnt_set_keymode(hw, (u8 *)conf->bssid, key,
165-
VNT_KEY_GROUP_ADDRESS, key_dec_mode, true);
166-
}
167-
168160
return 0;
169161
}

drivers/staging/vt6656/main_usb.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,8 +855,12 @@ static int vnt_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
855855
case SET_KEY:
856856
return vnt_set_keys(hw, sta, vif, key);
857857
case DISABLE_KEY:
858-
if (test_bit(key->hw_key_idx, &priv->key_entry_inuse))
858+
if (test_bit(key->hw_key_idx, &priv->key_entry_inuse)) {
859859
clear_bit(key->hw_key_idx, &priv->key_entry_inuse);
860+
861+
vnt_mac_disable_keyentry(priv, key->hw_key_idx);
862+
}
863+
860864
default:
861865
break;
862866
}

0 commit comments

Comments
 (0)