提交 f8c03053 编写于 作者: K Kalle Valo

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: NKalle Valo <kvalo@qca.qualcomm.com>
上级 84841ba2
...@@ -2695,11 +2695,13 @@ static int ath6kl_set_bitrate_mask64(struct wmi *wmi, u8 if_idx, ...@@ -2695,11 +2695,13 @@ static int ath6kl_set_bitrate_mask64(struct wmi *wmi, u8 if_idx,
{ {
struct sk_buff *skb; struct sk_buff *skb;
int ret, mode, band; int ret, mode, band;
u64 mcsrate, ratemask[IEEE80211_NUM_BANDS]; u64 mcsrate, ratemask[ATH6KL_NUM_BANDS];
struct wmi_set_tx_select_rates64_cmd *cmd; struct wmi_set_tx_select_rates64_cmd *cmd;
memset(&ratemask, 0, sizeof(ratemask)); memset(&ratemask, 0, sizeof(ratemask));
for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
/* only check 2.4 and 5 GHz bands, skip the rest */
for (band = 0; band <= IEEE80211_BAND_5GHZ; band++) {
/* copy legacy rate mask */ /* copy legacy rate mask */
ratemask[band] = mask->control[band].legacy; ratemask[band] = mask->control[band].legacy;
if (band == IEEE80211_BAND_5GHZ) if (band == IEEE80211_BAND_5GHZ)
...@@ -2745,11 +2747,13 @@ static int ath6kl_set_bitrate_mask32(struct wmi *wmi, u8 if_idx, ...@@ -2745,11 +2747,13 @@ static int ath6kl_set_bitrate_mask32(struct wmi *wmi, u8 if_idx,
{ {
struct sk_buff *skb; struct sk_buff *skb;
int ret, mode, band; int ret, mode, band;
u32 mcsrate, ratemask[IEEE80211_NUM_BANDS]; u32 mcsrate, ratemask[ATH6KL_NUM_BANDS];
struct wmi_set_tx_select_rates32_cmd *cmd; struct wmi_set_tx_select_rates32_cmd *cmd;
memset(&ratemask, 0, sizeof(ratemask)); memset(&ratemask, 0, sizeof(ratemask));
for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
/* only check 2.4 and 5 GHz bands, skip the rest */
for (band = 0; band <= IEEE80211_BAND_5GHZ; band++) {
/* copy legacy rate mask */ /* copy legacy rate mask */
ratemask[band] = mask->control[band].legacy; ratemask[band] = mask->control[band].legacy;
if (band == IEEE80211_BAND_5GHZ) if (band == IEEE80211_BAND_5GHZ)
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#define A_BAND_24GHZ 0 #define A_BAND_24GHZ 0
#define A_BAND_5GHZ 1 #define A_BAND_5GHZ 1
#define A_NUM_BANDS 2 #define ATH6KL_NUM_BANDS 2
/* in ms */ /* in ms */
#define WMI_IMPLICIT_PSTREAM_INACTIVITY_INT 5000 #define WMI_IMPLICIT_PSTREAM_INACTIVITY_INT 5000
...@@ -853,7 +853,7 @@ struct wmi_begin_scan_cmd { ...@@ -853,7 +853,7 @@ struct wmi_begin_scan_cmd {
u8 scan_type; u8 scan_type;
/* Supported rates to advertise in the probe request frames */ /* Supported rates to advertise in the probe request frames */
struct wmi_supp_rates supp_rates[IEEE80211_NUM_BANDS]; struct wmi_supp_rates supp_rates[ATH6KL_NUM_BANDS];
/* how many channels follow */ /* how many channels follow */
u8 num_ch; u8 num_ch;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册