diff options
author | Sujith Manoharan <c_manoha@qca.qualcomm.com> | 2012-08-10 07:17:03 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-08-10 15:27:16 -0400 |
commit | c1610117f81ae70b49aaf51ccb9040f2ce5bd358 (patch) | |
tree | cd84f48e375e6cd693221c996917b4726121f664 | |
parent | 2e546755b947c08cdc1c4f2bdba70130c6ed0736 (diff) |
ath9k: Bail out properly before calculating rate index
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath/ath9k/rc.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c index a94c52b24a0b..0e3d20a864e6 100644 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c | |||
@@ -1264,23 +1264,12 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband, | |||
1264 | struct ath_softc *sc = priv; | 1264 | struct ath_softc *sc = priv; |
1265 | struct ath_rate_priv *ath_rc_priv = priv_sta; | 1265 | struct ath_rate_priv *ath_rc_priv = priv_sta; |
1266 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 1266 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
1267 | struct ieee80211_hdr *hdr; | 1267 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
1268 | int final_ts_idx = 0, tx_status = 0; | 1268 | int final_ts_idx = 0, tx_status = 0; |
1269 | int long_retry = 0; | 1269 | int long_retry = 0; |
1270 | __le16 fc; | 1270 | __le16 fc = hdr->frame_control; |
1271 | int i; | 1271 | int i; |
1272 | 1272 | ||
1273 | hdr = (struct ieee80211_hdr *)skb->data; | ||
1274 | fc = hdr->frame_control; | ||
1275 | for (i = 0; i < sc->hw->max_rates; i++) { | ||
1276 | struct ieee80211_tx_rate *rate = &tx_info->status.rates[i]; | ||
1277 | if (rate->idx < 0 || !rate->count) | ||
1278 | break; | ||
1279 | |||
1280 | final_ts_idx = i; | ||
1281 | long_retry = rate->count - 1; | ||
1282 | } | ||
1283 | |||
1284 | if (!priv_sta || !ieee80211_is_data(fc)) | 1273 | if (!priv_sta || !ieee80211_is_data(fc)) |
1285 | return; | 1274 | return; |
1286 | 1275 | ||
@@ -1292,6 +1281,15 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband, | |||
1292 | if (tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) | 1281 | if (tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) |
1293 | return; | 1282 | return; |
1294 | 1283 | ||
1284 | for (i = 0; i < sc->hw->max_rates; i++) { | ||
1285 | struct ieee80211_tx_rate *rate = &tx_info->status.rates[i]; | ||
1286 | if (rate->idx < 0 || !rate->count) | ||
1287 | break; | ||
1288 | |||
1289 | final_ts_idx = i; | ||
1290 | long_retry = rate->count - 1; | ||
1291 | } | ||
1292 | |||
1295 | if (!(tx_info->flags & IEEE80211_TX_STAT_ACK)) | 1293 | if (!(tx_info->flags & IEEE80211_TX_STAT_ACK)) |
1296 | tx_status = 1; | 1294 | tx_status = 1; |
1297 | 1295 | ||