stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, "Felix Fietkau" <nbd@openwrt.org>,
	"Magnus Määttä" <magnus.maatta@logica.com>,
	"John W. Linville" <linville@tuxdriver.com>
Subject: [ 34/95] ath9k_hw: prevent writes to const data on AR9160
Date: Fri, 09 Mar 2012 11:02:36 -0800	[thread overview]
Message-ID: <20120309190205.077563642@linuxfoundation.org> (raw)
In-Reply-To: <20120309194424.GA2134@kroah.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3587 bytes --]

3.2-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Felix Fietkau <nbd@openwrt.org>

commit 9bbb8168ed3d8b946f9c1901a63a675012de88f2 upstream.

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>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/wireless/ath/ath9k/ar5008_phy.c |   25 +------------------------
 drivers/net/wireless/ath/ath9k/ar9002_hw.c  |   19 +++++++++++++++++++
 drivers/net/wireless/ath/ath9k/hw.h         |    1 -
 3 files changed, 20 insertions(+), 25 deletions(-)

--- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
@@ -489,8 +489,6 @@ static int ar5008_hw_rf_alloc_ext_banks(
 	ATH_ALLOC_BANK(ah->analogBank6Data, ah->iniBank6.ia_rows);
 	ATH_ALLOC_BANK(ah->analogBank6TPCData, ah->iniBank6TPC.ia_rows);
 	ATH_ALLOC_BANK(ah->analogBank7Data, ah->iniBank7.ia_rows);
-	ATH_ALLOC_BANK(ah->addac5416_21,
-		       ah->iniAddac.ia_rows * ah->iniAddac.ia_columns);
 	ATH_ALLOC_BANK(ah->bank6Temp, ah->iniBank6.ia_rows);
 
 	return 0;
@@ -519,7 +517,6 @@ static void ar5008_hw_rf_free_ext_banks(
 	ATH_FREE_BANK(ah->analogBank6Data);
 	ATH_FREE_BANK(ah->analogBank6TPCData);
 	ATH_FREE_BANK(ah->analogBank7Data);
-	ATH_FREE_BANK(ah->addac5416_21);
 	ATH_FREE_BANK(ah->bank6Temp);
 
 #undef ATH_FREE_BANK
@@ -805,27 +802,7 @@ static int ar5008_hw_process_ini(struct
 	if (ah->eep_ops->set_addac)
 		ah->eep_ops->set_addac(ah, chan);
 
-	if (AR_SREV_5416_22_OR_LATER(ah)) {
-		REG_WRITE_ARRAY(&ah->iniAddac, 1, regWrites);
-	} else {
-		struct ar5416IniArray temp;
-		u32 addacSize =
-			sizeof(u32) * ah->iniAddac.ia_rows *
-			ah->iniAddac.ia_columns;
-
-		/* For AR5416 2.0/2.1 */
-		memcpy(ah->addac5416_21,
-		       ah->iniAddac.ia_array, addacSize);
-
-		/* override CLKDRV value at [row, column] = [31, 1] */
-		(ah->addac5416_21)[31 * ah->iniAddac.ia_columns + 1] = 0;
-
-		temp.ia_array = ah->addac5416_21;
-		temp.ia_columns = ah->iniAddac.ia_columns;
-		temp.ia_rows = ah->iniAddac.ia_rows;
-		REG_WRITE_ARRAY(&temp, 1, regWrites);
-	}
-
+	REG_WRITE_ARRAY(&ah->iniAddac, 1, regWrites);
 	REG_WRITE(ah, AR_PHY_ADC_SERIAL_CTL, AR_PHY_SEL_INTERNAL_ADDAC);
 
 	ENABLE_REGWRITE_BUFFER(ah);
--- 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(str
 		INIT_INI_ARRAY(&ah->iniAddac, ar5416Addac,
 			       ARRAY_SIZE(ar5416Addac), 2);
 	}
+
+	/* iniAddac needs to be modified for these chips */
+	if (AR_SREV_9160(ah) || !AR_SREV_5416_22_OR_LATER(ah)) {
+		struct ar5416IniArray *addac = &ah->iniAddac;
+		u32 size = sizeof(u32) * addac->ia_rows * addac->ia_columns;
+		u32 *data;
+
+		data = kmalloc(size, GFP_KERNEL);
+		if (!data)
+			return;
+
+		memcpy(data, addac->ia_array, size);
+		addac->ia_array = data;
+
+		if (!AR_SREV_5416_22_OR_LATER(ah)) {
+			/* override CLKDRV value */
+			INI_RA(addac, 31,1) = 0;
+		}
+	}
 }
 
 /* Support for Japan ch.14 (2484) spread */
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -772,7 +772,6 @@ struct ath_hw {
 	u32 *analogBank6Data;
 	u32 *analogBank6TPCData;
 	u32 *analogBank7Data;
-	u32 *addac5416_21;
 	u32 *bank6Temp;
 
 	u8 txpower_limit;



  parent reply	other threads:[~2012-03-09 19:02 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-09 19:44 [ 00/95] 3.2.10-stable review Greg KH
2012-03-09 19:02 ` [ 01/95] ARM: OMAP: make iommu subsys_initcall to fix builtin omap3isp Greg KH
2012-03-10 12:47   ` Ohad Ben-Cohen
2012-03-11 17:10     ` Greg KH
2012-03-09 19:02 ` [ 02/95] autofs: work around unhappy compat problem on x86-64 Greg KH
2012-03-09 19:02 ` [ 03/95] Fix autofs compile without CONFIG_COMPAT Greg KH
2012-03-09 19:02 ` [ 04/95] compat: fix compile breakage on s390 Greg KH
2012-03-09 19:02 ` [ 05/95] drm/i915: Prevent a machine hang by checking crtc->active before loading lut Greg KH
2012-03-09 19:02 ` [ 06/95] ARM: LPC32xx: serial.c: HW bug workaround Greg KH
2012-03-09 19:02 ` [ 07/95] ARM: LPC32xx: serial.c: Fixed loop limit Greg KH
2012-03-09 19:02 ` [ 08/95] ARM: LPC32xx: irq.c: Clear latched event Greg KH
2012-03-09 19:02 ` [ 09/95] ARM: LPC32xx: Fix interrupt controller init Greg KH
2012-03-09 19:02 ` [ 10/95] ARM: LPC32xx: Fix irq on GPI_28 Greg KH
2012-03-09 19:02 ` [ 11/95] watchdog: hpwdt: clean up set_memory_x call for 32 bit Greg KH
2012-03-09 19:02 ` [ 12/95] i2c: mxs: only flag completion when queue is completely done Greg KH
2012-03-09 19:02 ` [ 13/95] regulator: fix the ldo configure according to 88pm860x spec Greg KH
2012-03-09 19:02 ` [ 14/95] S390: KEYS: Enable the compat keyctl wrapper on s390x Greg KH
2012-03-09 19:02 ` [ 15/95] perf/x86/kvm: Fix Host-Only/Guest-Only counting with SVM disabled Greg KH
2012-03-09 19:02 ` [ 16/95] ALSA: hda/realtek - Fix resume of multiple input sources Greg KH
2012-03-09 19:02 ` [ 17/95] ALSA: hda - Add a fake mute feature Greg KH
2012-03-09 19:02 ` [ 18/95] ALSA: hda - Always set HP pin in unsol handler for STAC/IDT codecs Greg KH
2012-03-09 19:02 ` [ 19/95] regset: Prevent null pointer reference on readonly regsets Greg KH
2012-03-09 19:02 ` [ 20/95] regset: Return -EFAULT, not -EIO, on host-side memory fault Greg KH
2012-03-09 19:02 ` [ 21/95] mfd: Fix ACPI conflict check Greg KH
2012-03-09 19:02 ` [ 22/95] mfd: Test for jack detection when deciding if wm8994 should suspend Greg KH
2012-03-09 19:02 ` [ 23/95] genirq: Clear action->thread_mask if IRQ_ONESHOT is not set Greg KH
2012-03-09 19:02 ` [ 24/95] ARM: S3C24XX: DMA resume regression fix Greg KH
2012-03-09 19:02 ` [ 25/95] Move Logitech Harmony 900 from cdc_ether to zaurus Greg KH
2012-03-09 19:02 ` [ 26/95] alpha: fix 32/64-bit bug in futex support Greg KH
2012-03-09 19:02 ` [ 27/95] mmc: atmel-mci: dont use dma features when using DMA with no chan available Greg KH
2012-03-09 19:02 ` [ 28/95] mmc: sdhci-esdhc-imx: fix for mmc cards on i.MX5 Greg KH
2012-03-09 19:02 ` [ 29/95] aio: wake up waiters when freeing unused kiocbs Greg KH
2012-03-09 19:02 ` [ 30/95] mm: memcg: Correct unregistring of events attached to the same eventfd Greg KH
2012-03-09 19:02 ` [ 31/95] NOMMU: Dont need to clear vm_mm when deleting a VMA Greg KH
2012-03-09 19:02 ` [ 32/95] cifs: fix dentry refcount leak when opening a FIFO on lookup Greg KH
2012-03-09 19:02 ` [ 33/95] mac80211: zero initialize count field in ieee80211_tx_rate Greg KH
2012-03-09 19:02 ` Greg KH [this message]
2012-03-09 19:02 ` [ 35/95] kprobes: return proper error code from register_kprobe() Greg KH
2012-03-09 19:02 ` [ 36/95] mm: thp: fix BUG on mm->nr_ptes Greg KH
2012-03-09 19:02 ` [ 37/95] iwlwifi: fix key removal Greg KH
2012-03-09 19:02 ` [ 38/95] tty/powerpc: early udbg consoles cant be modules Greg KH
2012-03-09 19:02 ` [ 39/95] S390: qdio: fix handler function arguments for zfcp data router Greg KH
2012-03-09 19:02 ` [ 40/95] rapidio/tsi721: fix queue wrapping bug in inbound doorbell handler Greg KH
2012-03-09 19:02 ` [ 41/95] HID: usbhid: Add NOGET quirk for the AIREN Slim+ keyboard Greg KH
2012-03-09 19:02 ` [ 42/95] crypto: mv_cesa - fix final callback not ignoring input data Greg KH
2012-03-09 19:02 ` [ 43/95] [SCSI] osd_uld: Bump MAX_OSD_DEVICES from 64 to 1,048,576 Greg KH
2012-03-09 19:02 ` [ 44/95] viafb: select HW scaling on VX900 for IGA2 Greg KH
2012-03-09 19:02 ` [ 45/95] viafb: fix IGA1 modesetting on VX900 Greg KH
2012-03-09 19:02 ` [ 46/95] ASoC: dapm: Check for bias level when powering down Greg KH
2012-03-09 19:02 ` [ 47/95] ASoC: i.MX SSI: Fix DSP_A format Greg KH
2012-03-09 19:02 ` [ 48/95] bsg: fix sysfs link remove warning Greg KH
2012-03-09 19:02 ` [ 49/95] avr32: select generic atomic64_t support Greg KH
2012-03-09 19:02 ` [ 50/95] ACPI / PM: Do not save/restore NVS on Asus K54C/K54HR Greg KH
2012-03-09 19:02 ` [ 51/95] rtl8192cu: Add new device IDs Greg KH
2012-03-09 19:02 ` [ 52/95] drm/i915: gen7: implement rczunit workaround Greg KH
2012-03-09 19:02 ` [ 53/95] drm/i915: gen7: Implement an L3 caching workaround Greg KH
2012-03-09 19:02 ` [ 54/95] drm/i915: gen7: work around a system hang on IVB Greg KH
2012-03-09 19:02 ` [ 55/95] drm/i915: gen7: Disable the RHWO optimization as it can cause GPU hangs Greg KH
2012-03-09 19:02 ` [ 56/95] drm/i915: fix ELD writing for SandyBridge Greg KH
2012-03-09 19:02 ` [ 57/95] ARM: orion: Fix USB phy for orion5x Greg KH
2012-03-09 19:03 ` [ 58/95] ARM: orion: Fix Orion5x GPIO regression from MPP cleanup Greg KH
2012-03-09 19:03 ` [ 59/95] OMAP: 4430SDP/Panda: use gpio_free_array to free HDMI gpios Greg KH
2012-03-09 19:03 ` [ 60/95] OMAP: 4430SDP/Panda: rename HPD GPIO to CT_CP_HPD Greg KH
2012-03-09 19:03 ` [ 61/95] OMAPDSS: remove wrong HDMI HPD muxing Greg KH
2012-03-09 19:03 ` [ 62/95] OMAP: 4430SDP/Panda: setup HDMI GPIO muxes Greg KH
2012-03-09 19:03 ` [ 63/95] OMAP: 4430SDP/Panda: add HDMI HPD gpio Greg KH
2012-03-09 19:03 ` [ 64/95] OMAPDSS: HDMI: PHY burnout fix Greg KH
2012-03-09 19:03 ` [ 65/95] OMAPDSS: HDMI: hot plug detect fix Greg KH
2012-03-09 19:03 ` [ 66/95] ARM: 7345/1: errata: update workaround for A9 erratum #743622 Greg KH
2012-03-09 19:03 ` [ 67/95] ARM: 7354/1: perf: limit sample_period to half max_period in non-sampling mode Greg KH
2012-03-09 19:03 ` [ 68/95] ARM: 7355/1: perf: clear overflow flag when disabling counter on ARMv7 PMU Greg KH
2012-03-09 19:03 ` [ 69/95] ARM: 7356/1: perf: check that we have an event in the PMU IRQ handlers Greg KH
2012-03-09 19:03 ` [ 70/95] ARM: 7357/1: perf: fix overflow handling for xscale2 PMUs Greg KH
2012-03-09 19:03 ` [ 71/95] media: staging: lirc_serial: Fix init/exit order Greg KH
2012-03-09 19:03 ` [ 72/95] media: staging: lirc_serial: Free resources on failure paths of lirc_serial_probe() Greg KH
2012-03-09 19:03 ` [ 73/95] media: staging: lirc_serial: Fix deadlock on resume failure Greg KH
2012-03-09 19:03 ` [ 74/95] media: staging: lirc_serial: Do not assume error codes returned by request_irq() Greg KH
2012-03-09 19:03 ` [ 75/95] Input: ALPS - fix touchpad detection when buttons are pressed Greg KH
2012-03-09 19:03 ` [ 76/95] hwmon: (pmbus_core) Fix maximum number of POUT alarm attributes Greg KH
2012-03-09 19:03 ` [ 77/95] hwmon: (jc42) Add support for ST Microelectronics STTS2002 and STTS3000 Greg KH
2012-03-09 19:03 ` [ 78/95] hwmon: (jc42) Add support for AT30TS00, TS3000GB2, TSE2002GB2, and MCP9804 Greg KH
2012-03-09 19:03 ` [ 79/95] hwmon: (zl6100) Maintain delay parameter in driver instance data Greg KH
2012-03-09 19:03 ` [ 80/95] carl9170: Fix memory accounting when sta is in power-save mode Greg KH
2012-03-09 19:03 ` [ 81/95] carl9170: fix frame delivery if sta is in powersave mode Greg KH
2012-03-09 19:03 ` [ 82/95] drm/radeon/kms: set SX_MISC in the r6xx blit code (v2) Greg KH
2012-03-09 19:03 ` [ 83/95] net/usbnet: avoid recursive locking in usbnet_stop() Greg KH
2012-03-09 19:03 ` [ 84/95] x86/amd: iommu_set_device_table() must not be __init Greg KH
2012-03-09 19:03 ` [ 85/95] dm ioctl: do not leak argv if target message only contains whitespace Greg KH
2012-03-09 19:03 ` [ 86/95] dm io: fix discard support Greg KH
2012-03-09 19:03 ` [ 87/95] dm flakey: fix crash on read when corrupt_bio_byte not set Greg KH
2012-03-09 19:03 ` [ 88/95] dm thin metadata: remove incorrect close_device on creation error paths Greg KH
2012-03-09 19:03 ` [ 89/95] dm thin metadata: unlock superblock in init_pmd error path Greg KH
2012-03-09 19:03 ` [ 90/95] dm thin metadata: decrement counter after removing mapped block Greg KH
2012-03-09 19:03 ` [ 91/95] dm raid: set MD_CHANGE_DEVS when rebuilding Greg KH
2012-03-09 19:03 ` [ 92/95] dm raid: fix flush support Greg KH
2012-03-09 19:03 ` [ 93/95] cs5535-mfgpt: dont call __init function from __devinit Greg KH
2012-03-09 19:03 ` [ 94/95] mfd: Fix cs5535 section mismatch Greg KH
2012-03-09 19:03 ` [ 95/95] spi-topcliff-pch: rename pch_spi_pcidev to pch_spi_pcidev_driver Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120309190205.077563642@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=magnus.maatta@logica.com \
    --cc=nbd@openwrt.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).