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, Ming Lei <tom.leiming@gmail.com>,
Will Deacon <will.deacon@arm.com>,
Russell King <rmk+kernel@arm.linux.org.uk>
Subject: [ 69/95] ARM: 7356/1: perf: check that we have an event in the PMU IRQ handlers
Date: Fri, 09 Mar 2012 11:03:11 -0800 [thread overview]
Message-ID: <20120309190207.900560356@linuxfoundation.org> (raw)
In-Reply-To: <20120309194424.GA2134@kroah.com>
3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <will.deacon@arm.com>
commit f6f5a30c834135c9f2fa10400c59ebbdd9188567 upstream.
The PMU IRQ handlers in perf assume that if a counter has overflowed
then perf must be responsible. In the paranoid world of crazy hardware,
this could be false, so check that we do have a valid event before
attempting to dereference NULL in the interrupt path.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arm/kernel/perf_event_v6.c | 20 ++------------------
arch/arm/kernel/perf_event_v7.c | 4 ++++
arch/arm/kernel/perf_event_xscale.c | 6 ++++++
3 files changed, 12 insertions(+), 18 deletions(-)
--- a/arch/arm/kernel/perf_event_v6.c
+++ b/arch/arm/kernel/perf_event_v6.c
@@ -463,23 +463,6 @@ armv6pmu_enable_event(struct hw_perf_eve
raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
}
-static int counter_is_active(unsigned long pmcr, int idx)
-{
- unsigned long mask = 0;
- if (idx == ARMV6_CYCLE_COUNTER)
- mask = ARMV6_PMCR_CCOUNT_IEN;
- else if (idx == ARMV6_COUNTER0)
- mask = ARMV6_PMCR_COUNT0_IEN;
- else if (idx == ARMV6_COUNTER1)
- mask = ARMV6_PMCR_COUNT1_IEN;
-
- if (mask)
- return pmcr & mask;
-
- WARN_ONCE(1, "invalid counter number (%d)\n", idx);
- return 0;
-}
-
static irqreturn_t
armv6pmu_handle_irq(int irq_num,
void *dev)
@@ -509,7 +492,8 @@ armv6pmu_handle_irq(int irq_num,
struct perf_event *event = cpuc->events[idx];
struct hw_perf_event *hwc;
- if (!counter_is_active(pmcr, idx))
+ /* Ignore if we don't have an event. */
+ if (!event)
continue;
/*
--- a/arch/arm/kernel/perf_event_v7.c
+++ b/arch/arm/kernel/perf_event_v7.c
@@ -1029,6 +1029,10 @@ static irqreturn_t armv7pmu_handle_irq(i
struct perf_event *event = cpuc->events[idx];
struct hw_perf_event *hwc;
+ /* Ignore if we don't have an event. */
+ if (!event)
+ continue;
+
/*
* We have a single interrupt for all counters. Check that
* each counter has overflowed before we process it.
--- a/arch/arm/kernel/perf_event_xscale.c
+++ b/arch/arm/kernel/perf_event_xscale.c
@@ -253,6 +253,9 @@ xscale1pmu_handle_irq(int irq_num, void
struct perf_event *event = cpuc->events[idx];
struct hw_perf_event *hwc;
+ if (!event)
+ continue;
+
if (!xscale1_pmnc_counter_has_overflowed(pmnc, idx))
continue;
@@ -590,6 +593,9 @@ xscale2pmu_handle_irq(int irq_num, void
struct perf_event *event = cpuc->events[idx];
struct hw_perf_event *hwc;
+ if (!event)
+ continue;
+
if (!xscale2_pmnc_counter_has_overflowed(pmnc, idx))
continue;
next prev parent reply other threads:[~2012-03-09 19:03 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 ` [ 34/95] ath9k_hw: prevent writes to const data on AR9160 Greg KH
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 ` Greg KH [this message]
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=20120309190207.900560356@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk+kernel@arm.linux.org.uk \
--cc=stable@vger.kernel.org \
--cc=tom.leiming@gmail.com \
--cc=torvalds@linux-foundation.org \
--cc=will.deacon@arm.com \
/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).