diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2017-12-05 09:35:08 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2017-12-14 10:30:11 -0500 |
commit | 413fd2f5c0233d3cde391679b967c1f14cd2cb27 (patch) | |
tree | 70ad08d2ebd132a02fa38c755a5cb15ecfa56748 | |
parent | 2f3bef4b247e4843ebf81123004fa9252b948724 (diff) |
ath9k_htc: Add a sanity check in ath9k_htc_ampdu_action()
Smatch generates a warning here:
drivers/net/wireless/ath/ath9k/htc_drv_main.c:1688 ath9k_htc_ampdu_action()
error: buffer overflow 'ista->tid_state' 8 <= 15
I don't know if it's a real bug or not but the other paths through this
function all ensure that "tid" is less than ATH9K_HTC_MAX_TID (8) so
checking here makes things more consistent.
Fixes: fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r-- | drivers/net/wireless/ath/ath9k/htc_drv_main.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c index f808e5833d7e..a82ad739ab80 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c | |||
@@ -1683,6 +1683,10 @@ static int ath9k_htc_ampdu_action(struct ieee80211_hw *hw, | |||
1683 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); | 1683 | ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
1684 | break; | 1684 | break; |
1685 | case IEEE80211_AMPDU_TX_OPERATIONAL: | 1685 | case IEEE80211_AMPDU_TX_OPERATIONAL: |
1686 | if (tid >= ATH9K_HTC_MAX_TID) { | ||
1687 | ret = -EINVAL; | ||
1688 | break; | ||
1689 | } | ||
1686 | ista = (struct ath9k_htc_sta *) sta->drv_priv; | 1690 | ista = (struct ath9k_htc_sta *) sta->drv_priv; |
1687 | spin_lock_bh(&priv->tx.tx_lock); | 1691 | spin_lock_bh(&priv->tx.tx_lock); |
1688 | ista->tid_state[tid] = AGGR_OPERATIONAL; | 1692 | ista->tid_state[tid] = AGGR_OPERATIONAL; |