aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/ar9002_hw.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2012-02-15 13:31:20 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-02-21 14:45:25 -0500
commit9bbb8168ed3d8b946f9c1901a63a675012de88f2 (patch)
tree2719d974ce305af5633ed350b1c04c0808319b8e /drivers/net/wireless/ath/ath9k/ar9002_hw.c
parent2504a6423b9ab4c36df78227055995644de19edb (diff)
ath9k_hw: prevent writes to const data on AR9160
Duplicate the data for iniAddac early on, to avoid having to do redundant memcpy calls later. While we're at it, make AR5416 < v2.2 use the same codepath. Fixes a reported crash on x86. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Reported-by: Magnus Määttä <magnus.maatta@logica.com> Cc: stable@vger.kernel.org Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/ar9002_hw.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9002_hw.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
index 11f192a1ceb7..d190411ac8f5 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c
@@ -180,6 +180,25 @@ static void ar9002_hw_init_mode_regs(struct ath_hw *ah)
180 INIT_INI_ARRAY(&ah->iniAddac, ar5416Addac, 180 INIT_INI_ARRAY(&ah->iniAddac, ar5416Addac,
181 ARRAY_SIZE(ar5416Addac), 2); 181 ARRAY_SIZE(ar5416Addac), 2);
182 } 182 }
183
184 /* iniAddac needs to be modified for these chips */
185 if (AR_SREV_9160(ah) || !AR_SREV_5416_22_OR_LATER(ah)) {
186 struct ar5416IniArray *addac = &ah->iniAddac;
187 u32 size = sizeof(u32) * addac->ia_rows * addac->ia_columns;
188 u32 *data;
189
190 data = kmalloc(size, GFP_KERNEL);
191 if (!data)
192 return;
193
194 memcpy(data, addac->ia_array, size);
195 addac->ia_array = data;
196
197 if (!AR_SREV_5416_22_OR_LATER(ah)) {
198 /* override CLKDRV value */
199 INI_RA(addac, 31,1) = 0;
200 }
201 }
183} 202}
184 203
185/* Support for Japan ch.14 (2484) spread */ 204/* Support for Japan ch.14 (2484) spread */