···475 if (!test_and_set_bit(i, &priv->ucode_key_table))476 return i;477478- return -1;479}480481int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, u8 send_if_empty)···620 /* else, we are overriding an existing key => no need to allocated room621 * in uCode. */622000623 priv->stations[sta_id].sta.key.key_flags = key_flags;624 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;625 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;···640{641 unsigned long flags;642 __le16 key_flags = 0;0643644 key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK);645 key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);···668 /* else, we are overriding an existing key => no need to allocated room669 * in uCode. */670000671 priv->stations[sta_id].sta.key.key_flags = key_flags;672 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;673 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;67400675 spin_unlock_irqrestore(&priv->sta_lock, flags);676677- IWL_DEBUG_INFO("hwcrypto: modify ucode station key info\n");678- return iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);679}680681static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv,···703 iwl_get_free_ucode_key_index(priv);704 /* else, we are overriding an existing key => no need to allocated room705 * in uCode. */000706707 /* This copy is acutally not needed: we get the key with each TX */708 memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, 16);···741 * been replaced by another one with different index.742 * Don't do anything and return ok743 */0000000744 spin_unlock_irqrestore(&priv->sta_lock, flags);745 return 0;746 }
···475 if (!test_and_set_bit(i, &priv->ucode_key_table))476 return i;477478+ return WEP_INVALID_OFFSET;479}480481int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, u8 send_if_empty)···620 /* else, we are overriding an existing key => no need to allocated room621 * in uCode. */622623+ WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,624+ "no space for new kew");625+626 priv->stations[sta_id].sta.key.key_flags = key_flags;627 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;628 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;···637{638 unsigned long flags;639 __le16 key_flags = 0;640+ int ret;641642 key_flags |= (STA_KEY_FLG_CCMP | STA_KEY_FLG_MAP_KEY_MSK);643 key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);···664 /* else, we are overriding an existing key => no need to allocated room665 * in uCode. */666667+ WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,668+ "no space for new kew");669+670 priv->stations[sta_id].sta.key.key_flags = key_flags;671 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;672 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;673674+ ret = iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);675+676 spin_unlock_irqrestore(&priv->sta_lock, flags);677678+ return ret;0679}680681static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv,···695 iwl_get_free_ucode_key_index(priv);696 /* else, we are overriding an existing key => no need to allocated room697 * in uCode. */698+699+ WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,700+ "no space for new kew");701702 /* This copy is acutally not needed: we get the key with each TX */703 memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, 16);···730 * been replaced by another one with different index.731 * Don't do anything and return ok732 */733+ spin_unlock_irqrestore(&priv->sta_lock, flags);734+ return 0;735+ }736+737+ if (priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET) {738+ IWL_WARNING("Removing wrong key %d 0x%x\n",739+ keyconf->keyidx, key_flags);740 spin_unlock_irqrestore(&priv->sta_lock, flags);741 return 0;742 }
···99100 sta = rcu_dereference(local->sta_hash[STA_HASH(addr)]);101 while (sta) {102- if (compare_ether_addr(sta->sta.addr, addr) == 0)103 break;104 sta = rcu_dereference(sta->hnext);105 }
···99100 sta = rcu_dereference(local->sta_hash[STA_HASH(addr)]);101 while (sta) {102+ if (memcmp(sta->sta.addr, addr, ETH_ALEN) == 0)103 break;104 sta = rcu_dereference(sta->hnext);105 }