staging: vt6656: Fix return for unsupported cipher modes.
authorMalcolm Priestley <tvboxspy@gmail.com>
Sun, 2 Feb 2020 12:28:07 +0000 (12:28 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 10 Feb 2020 00:22:56 +0000 (16:22 -0800)
mac80211 expect to see -EOPNOTSUPP on unsupported ciphers so
these can be done on stack.

correct all the returns to do this.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/b65a3b23-735f-f679-0f16-a54c3266b5ae@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vt6656/key.c
drivers/staging/vt6656/main_usb.c

index dcd933a..41b73f9 100644 (file)
@@ -144,11 +144,14 @@ int vnt_set_keys(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
                break;
        case WLAN_CIPHER_SUITE_CCMP:
                if (priv->local_id <= MAC_REVISION_A1)
-                       return -EINVAL;
+                       return -EOPNOTSUPP;
 
                key_dec_mode = KEY_CTL_CCMP;
 
                key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
+               break;
+       default:
+               return -EOPNOTSUPP;
        }
 
        if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) {
index 17a3dae..9135aad 100644 (file)
@@ -858,9 +858,7 @@ static int vnt_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 
        switch (cmd) {
        case SET_KEY:
-               if (vnt_set_keys(hw, sta, vif, key))
-                       return -EOPNOTSUPP;
-               break;
+               return vnt_set_keys(hw, sta, vif, key);
        case DISABLE_KEY:
                if (test_bit(key->hw_key_idx, &priv->key_entry_inuse))
                        clear_bit(key->hw_key_idx, &priv->key_entry_inuse);