stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 3.14 18/37] ath9k: fix buffer overrun for ar9287
Date: Mon, 18 Apr 2016 11:25:50 +0900	[thread overview]
Message-ID: <20160418022401.675678155@linuxfoundation.org> (raw)
In-Reply-To: <20160418022400.661946311@linuxfoundation.org>

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

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

From: Arnd Bergmann <arnd@arndb.de>

[ Upstream commit 83d6f1f15f8cce844b0a131cbc63e444620e48b5 ]

Code that was added back in 2.6.38 has an obvious overflow
when accessing a static array, and at the time it was added
only a code comment was put in front of it as a reminder
to have it reviewed properly.

This has not happened, but gcc-6 now points to the specific
overflow:

drivers/net/wireless/ath/ath9k/eeprom.c: In function 'ath9k_hw_get_gain_boundaries_pdadcs':
drivers/net/wireless/ath/ath9k/eeprom.c:483:44: error: array subscript is above array bounds [-Werror=array-bounds]
     maxPwrT4[i] = data_9287[idxL].pwrPdg[i][4];
                   ~~~~~~~~~~~~~~~~~~~~~~~~~^~~

It turns out that the correct array length exists in the local
'intercepts' variable of this function, so we can just use that
instead of hardcoding '4', so this patch changes all three
instances to use that variable. The other two instances were
already correct, but it's more consistent this way.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 940cd2c12ebf ("ath9k_hw: merge the ar9287 version of ath9k_hw_get_gain_boundaries_pdadcs")
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/wireless/ath/ath9k/eeprom.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

--- a/drivers/net/wireless/ath/ath9k/eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
@@ -408,10 +408,9 @@ void ath9k_hw_get_gain_boundaries_pdadcs
 
 	if (match) {
 		if (AR_SREV_9287(ah)) {
-			/* FIXME: array overrun? */
 			for (i = 0; i < numXpdGains; i++) {
 				minPwrT4[i] = data_9287[idxL].pwrPdg[i][0];
-				maxPwrT4[i] = data_9287[idxL].pwrPdg[i][4];
+				maxPwrT4[i] = data_9287[idxL].pwrPdg[i][intercepts - 1];
 				ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
 						data_9287[idxL].pwrPdg[i],
 						data_9287[idxL].vpdPdg[i],
@@ -421,7 +420,7 @@ void ath9k_hw_get_gain_boundaries_pdadcs
 		} else if (eeprom_4k) {
 			for (i = 0; i < numXpdGains; i++) {
 				minPwrT4[i] = data_4k[idxL].pwrPdg[i][0];
-				maxPwrT4[i] = data_4k[idxL].pwrPdg[i][4];
+				maxPwrT4[i] = data_4k[idxL].pwrPdg[i][intercepts - 1];
 				ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
 						data_4k[idxL].pwrPdg[i],
 						data_4k[idxL].vpdPdg[i],
@@ -431,7 +430,7 @@ void ath9k_hw_get_gain_boundaries_pdadcs
 		} else {
 			for (i = 0; i < numXpdGains; i++) {
 				minPwrT4[i] = data_def[idxL].pwrPdg[i][0];
-				maxPwrT4[i] = data_def[idxL].pwrPdg[i][4];
+				maxPwrT4[i] = data_def[idxL].pwrPdg[i][intercepts - 1];
 				ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
 						data_def[idxL].pwrPdg[i],
 						data_def[idxL].vpdPdg[i],

  parent reply	other threads:[~2016-04-18  2:25 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-18  2:25 [PATCH 3.14 00/37] 3.14.67-stable review Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 01/37] hwmon: (max1111) Return -ENODEV from max1111_read_channel if not instantiated Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 02/37] parisc: Avoid function pointers for kernel exception routines Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 03/37] parisc: Fix kernel crash with reversed copy_from_user() Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 04/37] ALSA: timer: Use mod_timer() for rearming the system timer Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 05/37] mm: fix invalid node in alloc_migrate_target() Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 06/37] drm/radeon: add a dpm quirk for sapphire Dual-X R7 370 2G D5 Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 07/37] drm/radeon: add a dpm quirk for all R7 370 parts Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 08/37] xen/events: Mask a moving irq Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 09/37] net: jme: fix suspend/resume on JMC260 Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 10/37] sctp: lack the check for ports in sctp_v6_cmp_addr Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 11/37] ipv6: re-enable fragment header matching in ipv6_find_hdr Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 13/37] usbnet: cleanup after bind() in probe() Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 14/37] udp6: fix UDP/IPv6 encap resubmit path Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 15/37] sh_eth: fix NULL pointer dereference in sh_eth_ring_format() Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 16/37] net: Fix use after free in the recvmmsg exit path Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 17/37] farsync: fix off-by-one bug in fst_add_one Greg Kroah-Hartman
2016-04-18  2:25 ` Greg Kroah-Hartman [this message]
2016-04-18  2:25 ` [PATCH 3.14 19/37] qlge: Fix receive packets drop Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 20/37] ipv4: fix broadcast packets reception Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 21/37] ppp: take reference on channels netns Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 23/37] ipv4: l2tp: fix a potential issue in l2tp_ip_recv Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 24/37] ipv6: l2tp: fix a potential issue in l2tp_ip6_recv Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 25/37] ip6_tunnel: set rtnl_link_ops before calling register_netdevice Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 26/37] mac80211: fix unnecessary frame drops in mesh fwding Greg Kroah-Hartman
2016-04-18  2:25 ` [PATCH 3.14 27/37] usb: renesas_usbhs: avoid NULL pointer derefernce in usbhsf_pkt_handler() Greg Kroah-Hartman
2016-04-18  2:26 ` [PATCH 3.14 28/37] usb: renesas_usbhs: disable TX IRQ before starting TX DMAC transfer Greg Kroah-Hartman
2016-04-18  2:26 ` [PATCH 3.14 29/37] ext4: add lockdep annotations for i_data_sem Greg Kroah-Hartman
2016-04-18  2:26 ` [PATCH 3.14 30/37] perf: Cure event->pending_disable race Greg Kroah-Hartman
2016-04-18  2:26 ` [PATCH 3.14 31/37] HID: usbhid: fix inconsistent reset/resume/reset-resume behavior Greg Kroah-Hartman
2016-04-18  2:26 ` [PATCH 3.14 34/37] [media] usbvision fix overflow of interfaces array Greg Kroah-Hartman
2016-04-18  2:26 ` [PATCH 3.14 35/37] [media] usbvision: fix leak of usb_dev on failure paths in usbvision_probe() Greg Kroah-Hartman
2016-04-18  2:26 ` [PATCH 3.14 36/37] [media] usbvision: fix crash on detecting device with invalid configuration Greg Kroah-Hartman
2016-04-18  2:26 ` [PATCH 3.14 37/37] Revert "usb: hub: do not clear BOS field during reset device" Greg Kroah-Hartman
2016-04-18 16:33 ` [PATCH 3.14 00/37] 3.14.67-stable review Guenter Roeck
2016-04-18 16:33 ` Shuah Khan

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=20160418022401.675678155@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.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).