aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalle Valo <kvalo@qca.qualcomm.com>2012-07-12 05:13:12 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2012-10-24 04:49:37 -0400
commitf8c0305383121817c77d400c788d82ca1a74582c (patch)
treea07ce429132a6afc06c46298d11737d1927798af
parent84841ba29b1f55fb09703408477f097c7f8952f8 (diff)
ath6kl: fix incorrect use of IEEE80211_NUM_BANDS
ath6kl was incorrectly assuming that IEEE80211_NUM_BANDS will always be 2 and used that also in the firmware WMI interface definitions. But after the support for 60 GHz was added to cfg80211 IEEE80211_NUM_BANDS changed to 3 and this can cause all sort of problems, possibly even memory corruption. I only found this during code review and didn't notice any bugs, but I'm sure there are a few lurking somewhere. To fix this rename unused A_NUM_BANDS to ATH6KL_NUM_BANDS, which is always defined to be 2, and use that in WMI. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath6kl/wmi.c12
-rw-r--r--drivers/net/wireless/ath/ath6kl/wmi.h4
2 files changed, 10 insertions, 6 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c
index cf91348fdbdb..d485a7c3428d 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.c
+++ b/drivers/net/wireless/ath/ath6kl/wmi.c
@@ -2695,11 +2695,13 @@ static int ath6kl_set_bitrate_mask64(struct wmi *wmi, u8 if_idx,
2695{ 2695{
2696 struct sk_buff *skb; 2696 struct sk_buff *skb;
2697 int ret, mode, band; 2697 int ret, mode, band;
2698 u64 mcsrate, ratemask[IEEE80211_NUM_BANDS]; 2698 u64 mcsrate, ratemask[ATH6KL_NUM_BANDS];
2699 struct wmi_set_tx_select_rates64_cmd *cmd; 2699 struct wmi_set_tx_select_rates64_cmd *cmd;
2700 2700
2701 memset(&ratemask, 0, sizeof(ratemask)); 2701 memset(&ratemask, 0, sizeof(ratemask));
2702 for (band = 0; band < IEEE80211_NUM_BANDS; band++) { 2702
2703 /* only check 2.4 and 5 GHz bands, skip the rest */
2704 for (band = 0; band <= IEEE80211_BAND_5GHZ; band++) {
2703 /* copy legacy rate mask */ 2705 /* copy legacy rate mask */
2704 ratemask[band] = mask->control[band].legacy; 2706 ratemask[band] = mask->control[band].legacy;
2705 if (band == IEEE80211_BAND_5GHZ) 2707 if (band == IEEE80211_BAND_5GHZ)
@@ -2745,11 +2747,13 @@ static int ath6kl_set_bitrate_mask32(struct wmi *wmi, u8 if_idx,
2745{ 2747{
2746 struct sk_buff *skb; 2748 struct sk_buff *skb;
2747 int ret, mode, band; 2749 int ret, mode, band;
2748 u32 mcsrate, ratemask[IEEE80211_NUM_BANDS]; 2750 u32 mcsrate, ratemask[ATH6KL_NUM_BANDS];
2749 struct wmi_set_tx_select_rates32_cmd *cmd; 2751 struct wmi_set_tx_select_rates32_cmd *cmd;
2750 2752
2751 memset(&ratemask, 0, sizeof(ratemask)); 2753 memset(&ratemask, 0, sizeof(ratemask));
2752 for (band = 0; band < IEEE80211_NUM_BANDS; band++) { 2754
2755 /* only check 2.4 and 5 GHz bands, skip the rest */
2756 for (band = 0; band <= IEEE80211_BAND_5GHZ; band++) {
2753 /* copy legacy rate mask */ 2757 /* copy legacy rate mask */
2754 ratemask[band] = mask->control[band].legacy; 2758 ratemask[band] = mask->control[band].legacy;
2755 if (band == IEEE80211_BAND_5GHZ) 2759 if (band == IEEE80211_BAND_5GHZ)
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.h b/drivers/net/wireless/ath/ath6kl/wmi.h
index 1d510bae1558..9c73ae73f26b 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.h
+++ b/drivers/net/wireless/ath/ath6kl/wmi.h
@@ -48,7 +48,7 @@
48 48
49#define A_BAND_24GHZ 0 49#define A_BAND_24GHZ 0
50#define A_BAND_5GHZ 1 50#define A_BAND_5GHZ 1
51#define A_NUM_BANDS 2 51#define ATH6KL_NUM_BANDS 2
52 52
53/* in ms */ 53/* in ms */
54#define WMI_IMPLICIT_PSTREAM_INACTIVITY_INT 5000 54#define WMI_IMPLICIT_PSTREAM_INACTIVITY_INT 5000
@@ -853,7 +853,7 @@ struct wmi_begin_scan_cmd {
853 u8 scan_type; 853 u8 scan_type;
854 854
855 /* Supported rates to advertise in the probe request frames */ 855 /* Supported rates to advertise in the probe request frames */
856 struct wmi_supp_rates supp_rates[IEEE80211_NUM_BANDS]; 856 struct wmi_supp_rates supp_rates[ATH6KL_NUM_BANDS];
857 857
858 /* how many channels follow */ 858 /* how many channels follow */
859 u8 num_ch; 859 u8 num_ch;