Commit a1b97440 authored by David S. Miller's avatar David S. Miller
parents 27fed417 89c3a8ac
...@@ -5918,20 +5918,19 @@ static int airo_set_essid(struct net_device *dev, ...@@ -5918,20 +5918,19 @@ static int airo_set_essid(struct net_device *dev,
readSsidRid(local, &SSID_rid); readSsidRid(local, &SSID_rid);
/* Check if we asked for `any' */ /* Check if we asked for `any' */
if(dwrq->flags == 0) { if (dwrq->flags == 0) {
/* Just send an empty SSID list */ /* Just send an empty SSID list */
memset(&SSID_rid, 0, sizeof(SSID_rid)); memset(&SSID_rid, 0, sizeof(SSID_rid));
} else { } else {
int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; unsigned index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
/* Check the size of the string */ /* Check the size of the string */
if(dwrq->length > IW_ESSID_MAX_SIZE) { if (dwrq->length > IW_ESSID_MAX_SIZE)
return -E2BIG ; return -E2BIG ;
}
/* Check if index is valid */ /* Check if index is valid */
if((index < 0) || (index >= 4)) { if (index >= ARRAY_SIZE(SSID_rid.ssids))
return -EINVAL; return -EINVAL;
}
/* Set the SSID */ /* Set the SSID */
memset(SSID_rid.ssids[index].ssid, 0, memset(SSID_rid.ssids[index].ssid, 0,
...@@ -6819,7 +6818,7 @@ static int airo_set_txpow(struct net_device *dev, ...@@ -6819,7 +6818,7 @@ static int airo_set_txpow(struct net_device *dev,
return -EINVAL; return -EINVAL;
} }
clear_bit (FLAG_RADIO_OFF, &local->flags); clear_bit (FLAG_RADIO_OFF, &local->flags);
for (i = 0; cap_rid.txPowerLevels[i] && (i < 8); i++) for (i = 0; i < 8 && cap_rid.txPowerLevels[i]; i++)
if (v == cap_rid.txPowerLevels[i]) { if (v == cap_rid.txPowerLevels[i]) {
readConfigRid(local, 1); readConfigRid(local, 1);
local->config.txPower = v; local->config.txPower = v;
......
...@@ -460,7 +460,7 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah) ...@@ -460,7 +460,7 @@ static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
integer = swab32(eep->modalHeader.antCtrlCommon); integer = swab32(eep->modalHeader.antCtrlCommon);
eep->modalHeader.antCtrlCommon = integer; eep->modalHeader.antCtrlCommon = integer;
for (i = 0; i < AR5416_MAX_CHAINS; i++) { for (i = 0; i < AR5416_EEP4K_MAX_CHAINS; i++) {
integer = swab32(eep->modalHeader.antCtrlChain[i]); integer = swab32(eep->modalHeader.antCtrlChain[i]);
eep->modalHeader.antCtrlChain[i] = integer; eep->modalHeader.antCtrlChain[i] = integer;
} }
...@@ -914,7 +914,7 @@ static void ath9k_hw_set_4k_power_per_rate_table(struct ath_hw *ah, ...@@ -914,7 +914,7 @@ static void ath9k_hw_set_4k_power_per_rate_table(struct ath_hw *ah,
ctlMode, numCtlModes, isHt40CtlMode, ctlMode, numCtlModes, isHt40CtlMode,
(pCtlMode[ctlMode] & EXT_ADDITIVE)); (pCtlMode[ctlMode] & EXT_ADDITIVE));
for (i = 0; (i < AR5416_NUM_CTLS) && for (i = 0; (i < AR5416_EEP4K_NUM_CTLS) &&
pEepData->ctlIndex[i]; i++) { pEepData->ctlIndex[i]; i++) {
DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
" LOOP-Ctlidx %d: cfgCtl 0x%2.2x " " LOOP-Ctlidx %d: cfgCtl 0x%2.2x "
......
...@@ -112,7 +112,7 @@ enum iwl3945_antenna { ...@@ -112,7 +112,7 @@ enum iwl3945_antenna {
#define IWL_TX_FIFO_NONE 7 #define IWL_TX_FIFO_NONE 7
/* Minimum number of queues. MAX_NUM is defined in hw specific files */ /* Minimum number of queues. MAX_NUM is defined in hw specific files */
#define IWL_MIN_NUM_QUEUES 4 #define IWL39_MIN_NUM_QUEUES 4
#define IEEE80211_DATA_LEN 2304 #define IEEE80211_DATA_LEN 2304
#define IEEE80211_4ADDR_LEN 30 #define IEEE80211_4ADDR_LEN 30
......
...@@ -258,8 +258,10 @@ struct iwl_channel_info { ...@@ -258,8 +258,10 @@ struct iwl_channel_info {
#define IWL_TX_FIFO_HCCA_2 6 #define IWL_TX_FIFO_HCCA_2 6
#define IWL_TX_FIFO_NONE 7 #define IWL_TX_FIFO_NONE 7
/* Minimum number of queues. MAX_NUM is defined in hw specific files */ /* Minimum number of queues. MAX_NUM is defined in hw specific files.
#define IWL_MIN_NUM_QUEUES 4 * Set the minimum to accommodate the 4 standard TX queues, 1 command
* queue, 2 (unused) HCCA queues, and 4 HT queues (one for each AC) */
#define IWL_MIN_NUM_QUEUES 10
/* Power management (not Tx power) structures */ /* Power management (not Tx power) structures */
......
...@@ -720,8 +720,6 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) ...@@ -720,8 +720,6 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
goto drop_unlock; goto drop_unlock;
} }
spin_unlock_irqrestore(&priv->lock, flags);
hdr_len = ieee80211_hdrlen(fc); hdr_len = ieee80211_hdrlen(fc);
/* Find (or create) index into station table for destination station */ /* Find (or create) index into station table for destination station */
...@@ -729,7 +727,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) ...@@ -729,7 +727,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
if (sta_id == IWL_INVALID_STATION) { if (sta_id == IWL_INVALID_STATION) {
IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n", IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n",
hdr->addr1); hdr->addr1);
goto drop; goto drop_unlock;
} }
IWL_DEBUG_TX(priv, "station Id %d\n", sta_id); IWL_DEBUG_TX(priv, "station Id %d\n", sta_id);
...@@ -750,14 +748,17 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) ...@@ -750,14 +748,17 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
txq_id = priv->stations[sta_id].tid[tid].agg.txq_id; txq_id = priv->stations[sta_id].tid[tid].agg.txq_id;
swq_id = iwl_virtual_agg_queue_num(swq_id, txq_id); swq_id = iwl_virtual_agg_queue_num(swq_id, txq_id);
} }
priv->stations[sta_id].tid[tid].tfds_in_queue++;
} }
txq = &priv->txq[txq_id]; txq = &priv->txq[txq_id];
q = &txq->q; q = &txq->q;
txq->swq_id = swq_id; txq->swq_id = swq_id;
spin_lock_irqsave(&priv->lock, flags); if (unlikely(iwl_queue_space(q) < q->high_mark))
goto drop_unlock;
if (ieee80211_is_data_qos(fc))
priv->stations[sta_id].tid[tid].tfds_in_queue++;
/* Set up driver data for this TFD */ /* Set up driver data for this TFD */
memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info));
...@@ -902,7 +903,6 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) ...@@ -902,7 +903,6 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
drop_unlock: drop_unlock:
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
drop:
return -1; return -1;
} }
EXPORT_SYMBOL(iwl_tx_skb); EXPORT_SYMBOL(iwl_tx_skb);
...@@ -1171,6 +1171,8 @@ int iwl_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn) ...@@ -1171,6 +1171,8 @@ int iwl_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn)
IWL_ERR(priv, "Start AGG on invalid station\n"); IWL_ERR(priv, "Start AGG on invalid station\n");
return -ENXIO; return -ENXIO;
} }
if (unlikely(tid >= MAX_TID_COUNT))
return -EINVAL;
if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_OFF) { if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_OFF) {
IWL_ERR(priv, "Start AGG when state is not IWL_AGG_OFF !\n"); IWL_ERR(priv, "Start AGG when state is not IWL_AGG_OFF !\n");
......
...@@ -4018,10 +4018,10 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e ...@@ -4018,10 +4018,10 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
SET_IEEE80211_DEV(hw, &pdev->dev); SET_IEEE80211_DEV(hw, &pdev->dev);
if ((iwl3945_mod_params.num_of_queues > IWL39_MAX_NUM_QUEUES) || if ((iwl3945_mod_params.num_of_queues > IWL39_MAX_NUM_QUEUES) ||
(iwl3945_mod_params.num_of_queues < IWL_MIN_NUM_QUEUES)) { (iwl3945_mod_params.num_of_queues < IWL39_MIN_NUM_QUEUES)) {
IWL_ERR(priv, IWL_ERR(priv,
"invalid queues_num, should be between %d and %d\n", "invalid queues_num, should be between %d and %d\n",
IWL_MIN_NUM_QUEUES, IWL39_MAX_NUM_QUEUES); IWL39_MIN_NUM_QUEUES, IWL39_MAX_NUM_QUEUES);
err = -EINVAL; err = -EINVAL;
goto out_ieee80211_free_hw; goto out_ieee80211_free_hw;
} }
......
...@@ -106,10 +106,8 @@ void *iwm_if_alloc(int sizeof_bus, struct device *dev, ...@@ -106,10 +106,8 @@ void *iwm_if_alloc(int sizeof_bus, struct device *dev,
int ret = 0; int ret = 0;
wdev = iwm_wdev_alloc(sizeof_bus, dev); wdev = iwm_wdev_alloc(sizeof_bus, dev);
if (!wdev) { if (IS_ERR(wdev))
dev_err(dev, "no memory for wireless device instance\n"); return wdev;
return ERR_PTR(-ENOMEM);
}
iwm = wdev_to_iwm(wdev); iwm = wdev_to_iwm(wdev);
iwm->bus_ops = if_ops; iwm->bus_ops = if_ops;
......
/* Copyright (C) 2006, Red Hat, Inc. */ /* Copyright (C) 2006, Red Hat, Inc. */
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/ieee80211.h> #include <linux/ieee80211.h>
#include <linux/if_arp.h> #include <linux/if_arp.h>
...@@ -43,21 +44,21 @@ static int get_common_rates(struct lbs_private *priv, ...@@ -43,21 +44,21 @@ static int get_common_rates(struct lbs_private *priv,
u16 *rates_size) u16 *rates_size)
{ {
u8 *card_rates = lbs_bg_rates; u8 *card_rates = lbs_bg_rates;
size_t num_card_rates = sizeof(lbs_bg_rates);
int ret = 0, i, j; int ret = 0, i, j;
u8 tmp[30]; u8 tmp[(ARRAY_SIZE(lbs_bg_rates) - 1) * (*rates_size - 1)];
size_t tmp_size = 0; size_t tmp_size = 0;
/* For each rate in card_rates that exists in rate1, copy to tmp */ /* For each rate in card_rates that exists in rate1, copy to tmp */
for (i = 0; card_rates[i] && (i < num_card_rates); i++) { for (i = 0; i < ARRAY_SIZE(lbs_bg_rates) && card_rates[i]; i++) {
for (j = 0; rates[j] && (j < *rates_size); j++) { for (j = 0; j < *rates_size && rates[j]; j++) {
if (rates[j] == card_rates[i]) if (rates[j] == card_rates[i])
tmp[tmp_size++] = card_rates[i]; tmp[tmp_size++] = card_rates[i];
} }
} }
lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size); lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size);
lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, num_card_rates); lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates,
ARRAY_SIZE(lbs_bg_rates));
lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size); lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size);
lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate); lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate);
...@@ -69,10 +70,7 @@ static int get_common_rates(struct lbs_private *priv, ...@@ -69,10 +70,7 @@ static int get_common_rates(struct lbs_private *priv,
lbs_pr_alert("Previously set fixed data rate %#x isn't " lbs_pr_alert("Previously set fixed data rate %#x isn't "
"compatible with the network.\n", priv->cur_rate); "compatible with the network.\n", priv->cur_rate);
ret = -1; ret = -1;
goto done;
} }
ret = 0;
done: done:
memset(rates, 0, *rates_size); memset(rates, 0, *rates_size);
*rates_size = min_t(int, tmp_size, *rates_size); *rates_size = min_t(int, tmp_size, *rates_size);
...@@ -322,7 +320,7 @@ static int lbs_associate(struct lbs_private *priv, ...@@ -322,7 +320,7 @@ static int lbs_associate(struct lbs_private *priv,
rates = (struct mrvl_ie_rates_param_set *) pos; rates = (struct mrvl_ie_rates_param_set *) pos;
rates->header.type = cpu_to_le16(TLV_TYPE_RATES); rates->header.type = cpu_to_le16(TLV_TYPE_RATES);
memcpy(&rates->rates, &bss->rates, MAX_RATES); memcpy(&rates->rates, &bss->rates, MAX_RATES);
tmplen = MAX_RATES; tmplen = min_t(u16, ARRAY_SIZE(rates->rates), MAX_RATES);
if (get_common_rates(priv, rates->rates, &tmplen)) { if (get_common_rates(priv, rates->rates, &tmplen)) {
ret = -1; ret = -1;
goto done; goto done;
...@@ -598,7 +596,7 @@ static int lbs_adhoc_join(struct lbs_private *priv, ...@@ -598,7 +596,7 @@ static int lbs_adhoc_join(struct lbs_private *priv,
/* Copy Data rates from the rates recorded in scan response */ /* Copy Data rates from the rates recorded in scan response */
memset(cmd.bss.rates, 0, sizeof(cmd.bss.rates)); memset(cmd.bss.rates, 0, sizeof(cmd.bss.rates));
ratesize = min_t(u16, sizeof(cmd.bss.rates), MAX_RATES); ratesize = min_t(u16, ARRAY_SIZE(cmd.bss.rates), MAX_RATES);
memcpy(cmd.bss.rates, bss->rates, ratesize); memcpy(cmd.bss.rates, bss->rates, ratesize);
if (get_common_rates(priv, cmd.bss.rates, &ratesize)) { if (get_common_rates(priv, cmd.bss.rates, &ratesize)) {
lbs_deb_join("ADHOC_JOIN: get_common_rates returned error.\n"); lbs_deb_join("ADHOC_JOIN: get_common_rates returned error.\n");
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* for sending scan commands to the firmware. * for sending scan commands to the firmware.
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/if_arp.h> #include <linux/if_arp.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
...@@ -876,7 +877,7 @@ static inline char *lbs_translate_scan(struct lbs_private *priv, ...@@ -876,7 +877,7 @@ static inline char *lbs_translate_scan(struct lbs_private *priv,
iwe.u.bitrate.disabled = 0; iwe.u.bitrate.disabled = 0;
iwe.u.bitrate.value = 0; iwe.u.bitrate.value = 0;
for (j = 0; bss->rates[j] && (j < sizeof(bss->rates)); j++) { for (j = 0; j < ARRAY_SIZE(bss->rates) && bss->rates[j]; j++) {
/* Bit rate given in 500 kb/s units */ /* Bit rate given in 500 kb/s units */
iwe.u.bitrate.value = bss->rates[j] * 500000; iwe.u.bitrate.value = bss->rates[j] * 500000;
current_val = iwe_stream_add_value(info, start, current_val, current_val = iwe_stream_add_value(info, start, current_val,
......
...@@ -721,7 +721,7 @@ void ieee80211_dynamic_ps_timer(unsigned long data) ...@@ -721,7 +721,7 @@ void ieee80211_dynamic_ps_timer(unsigned long data)
{ {
struct ieee80211_local *local = (void *) data; struct ieee80211_local *local = (void *) data;
if (local->quiescing) if (local->quiescing || local->suspended)
return; return;
queue_work(local->hw.workqueue, &local->dynamic_ps_enable_work); queue_work(local->hw.workqueue, &local->dynamic_ps_enable_work);
......
...@@ -55,15 +55,6 @@ int __ieee80211_suspend(struct ieee80211_hw *hw) ...@@ -55,15 +55,6 @@ int __ieee80211_suspend(struct ieee80211_hw *hw)
rcu_read_unlock(); rcu_read_unlock();
/* flush again, in case driver queued work */
flush_workqueue(local->hw.workqueue);
/* stop hardware - this must stop RX */
if (local->open_count) {
ieee80211_led_radio(local, false);
drv_stop(local);
}
/* remove STAs */ /* remove STAs */
spin_lock_irqsave(&local->sta_lock, flags); spin_lock_irqsave(&local->sta_lock, flags);
list_for_each_entry(sta, &local->sta_list, list) { list_for_each_entry(sta, &local->sta_list, list) {
...@@ -111,7 +102,22 @@ int __ieee80211_suspend(struct ieee80211_hw *hw) ...@@ -111,7 +102,22 @@ int __ieee80211_suspend(struct ieee80211_hw *hw)
drv_remove_interface(local, &conf); drv_remove_interface(local, &conf);
} }
/* stop hardware - this must stop RX */
if (local->open_count) {
ieee80211_led_radio(local, false);
drv_stop(local);
}
/*
* flush again, in case driver queued work -- it
* shouldn't be doing (or cancel everything in the
* stop callback) that but better safe than sorry.
*/
flush_workqueue(local->hw.workqueue);
local->suspended = true; local->suspended = true;
/* need suspended to be visible before quiescing is false */
barrier();
local->quiescing = false; local->quiescing = false;
return 0; return 0;
......
...@@ -2453,6 +2453,18 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, ...@@ -2453,6 +2453,18 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
return; return;
} }
/*
* If we're suspending, it is possible although not too likely
* that we'd be receiving frames after having already partially
* quiesced the stack. We can't process such frames then since
* that might, for example, cause stations to be added or other
* driver callbacks be invoked.
*/
if (unlikely(local->quiescing || local->suspended)) {
kfree_skb(skb);
return;
}
if (status->flag & RX_FLAG_HT) { if (status->flag & RX_FLAG_HT) {
/* rate_idx is MCS index */ /* rate_idx is MCS index */
if (WARN_ON(status->rate_idx < 0 || if (WARN_ON(status->rate_idx < 0 ||
......
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