public inbox for linux-kernel@vger.kernel.org
 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, "Huacai Chen" <chenhc@lemote.com>,
	"Binbin Zhou" <zhoubb@lemote.com>,
	"Michel Dänzer" <michel.daenzer@amd.com>,
	"Paul Menzel" <paulepanter@users.sourceforge.net>,
	"Dave Airlie" <airlied@gmail.com>
Subject: [ 54/79] drm: fix a use-after-free when GPU acceleration disabled
Date: Tue, 11 Jun 2013 13:03:20 -0700	[thread overview]
Message-ID: <20130611195323.215611167@linuxfoundation.org> (raw)
In-Reply-To: <20130611195312.352656079@linuxfoundation.org>

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

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

From: Huacai Chen <chenhc@lemote.com>

commit b7ea85a4fed37835eec78a7be3039c8dc22b8178 upstream.

When GPU acceleration is disabled, drm_vblank_cleanup() will free the
vblank-related data, such as vblank_refcount, vblank_inmodeset, etc.
But we found that drm_vblank_post_modeset() may be called after the
cleanup, which use vblank_refcount and vblank_inmodeset. And this will
cause a kernel panic.

Fix this by return immediately if dev->num_crtcs is zero. This is the
same thing that drm_vblank_pre_modeset() does.

Call trace of a drm_vblank_post_modeset() after drm_vblank_cleanup():
[   62.628906] [<ffffffff804868d0>] drm_vblank_post_modeset+0x34/0xb4
[   62.628906] [<ffffffff804c7008>] atombios_crtc_dpms+0xb4/0x174
[   62.628906] [<ffffffff804c70e0>] atombios_crtc_commit+0x18/0x38
[   62.628906] [<ffffffff8047f038>] drm_crtc_helper_set_mode+0x304/0x3cc
[   62.628906] [<ffffffff8047f92c>] drm_crtc_helper_set_config+0x6d8/0x988
[   62.628906] [<ffffffff8047dd40>] drm_fb_helper_set_par+0x94/0x104
[   62.628906] [<ffffffff80439d14>] fbcon_init+0x424/0x57c
[   62.628906] [<ffffffff8046a638>] visual_init+0xb8/0x118
[   62.628906] [<ffffffff8046b9f8>] take_over_console+0x238/0x384
[   62.628906] [<ffffffff80436df8>] fbcon_takeover+0x7c/0xdc
[   62.628906] [<ffffffff8024fa20>] notifier_call_chain+0x44/0x94
[   62.628906] [<ffffffff8024fcbc>] __blocking_notifier_call_chain+0x48/0x68
[   62.628906] [<ffffffff8042d990>] register_framebuffer+0x228/0x260
[   62.628906] [<ffffffff8047e010>] drm_fb_helper_single_fb_probe+0x260/0x314
[   62.628906] [<ffffffff8047e2c4>] drm_fb_helper_initial_config+0x200/0x234
[   62.628906] [<ffffffff804e5560>] radeon_fbdev_init+0xd4/0xf4
[   62.628906] [<ffffffff804e0e08>] radeon_modeset_init+0x9bc/0xa18
[   62.628906] [<ffffffff804bfc14>] radeon_driver_load_kms+0xdc/0x12c
[   62.628906] [<ffffffff8048b548>] drm_get_pci_dev+0x148/0x238
[   62.628906] [<ffffffff80423564>] local_pci_probe+0x5c/0xd0
[   62.628906] [<ffffffff80241ac4>] work_for_cpu_fn+0x1c/0x30
[   62.628906] [<ffffffff802427c8>] process_one_work+0x274/0x3bc
[   62.628906] [<ffffffff80242934>] process_scheduled_works+0x24/0x44
[   62.628906] [<ffffffff8024515c>] worker_thread+0x31c/0x3f4
[   62.628906] [<ffffffff802497a8>] kthread+0x88/0x90
[   62.628906] [<ffffffff80206794>] kernel_thread_helper+0x10/0x18

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Signed-off-by: Binbin Zhou <zhoubb@lemote.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Acked-by: Paul Menzel <paulepanter@users.sourceforge.net>
Signed-off-by: Dave Airlie <airlied@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/drm_irq.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -1054,7 +1054,7 @@ EXPORT_SYMBOL(drm_vblank_off);
  */
 void drm_vblank_pre_modeset(struct drm_device *dev, int crtc)
 {
-	/* vblank is not initialized (IRQ not installed ?) */
+	/* vblank is not initialized (IRQ not installed ?), or has been freed */
 	if (!dev->num_crtcs)
 		return;
 	/*
@@ -1076,6 +1076,10 @@ void drm_vblank_post_modeset(struct drm_
 {
 	unsigned long irqflags;
 
+	/* vblank is not initialized (IRQ not installed ?), or has been freed */
+	if (!dev->num_crtcs)
+		return;
+
 	if (dev->vblank_inmodeset[crtc]) {
 		spin_lock_irqsave(&dev->vbl_lock, irqflags);
 		dev->vblank_disable_allowed = 1;



  parent reply	other threads:[~2013-06-11 20:11 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-11 20:02 [ 00/79] 3.9.6-stable review Greg Kroah-Hartman
2013-06-11 20:02 ` [ 01/79] USB: serial: Add Option GTM681W to qcserial device table Greg Kroah-Hartman
2013-06-11 20:02 ` [ 02/79] USB: option: blacklist network interface on Huawei E1820 Greg Kroah-Hartman
2013-06-11 20:02 ` [ 03/79] USB: option,zte_ev: move most ZTE CDMA devices to zte_ev Greg Kroah-Hartman
2013-06-11 20:02 ` [ 04/79] usb: dwc3: pci: PHY should be deleted later than dwc3 core Greg Kroah-Hartman
2013-06-11 20:02 ` [ 05/79] xhci - correct comp_mode_recovery_timer on return from hibernate Greg Kroah-Hartman
2013-06-11 20:02 ` [ 06/79] xhci-mem: init list heads at the beginning of init Greg Kroah-Hartman
2013-06-11 20:02 ` [ 07/79] xhci: fix list access before init Greg Kroah-Hartman
2013-06-11 20:02 ` [ 08/79] xhci: Disable D3cold for buggy TI redrivers Greg Kroah-Hartman
2013-06-11 20:02 ` [ 09/79] x86/PCI: Map PCI setup data with ioremap() so it can be in highmem Greg Kroah-Hartman
2013-06-11 20:02 ` [ 10/79] usb: musb: make use_sg flag URB specific Greg Kroah-Hartman
2013-06-11 20:02 ` [ 11/79] ALSA: usb-audio: fix Roland/Cakewalk UM-3G support Greg Kroah-Hartman
2013-06-11 20:02 ` [ 12/79] ALSA: usb-audio - Apply Logitech QuickCam Pro 9000 quirk only to audio iface Greg Kroah-Hartman
2013-06-11 20:02 ` [ 13/79] ALSA: usb-audio - Fix invalid volume resolution on Logitech HD webcam c270 Greg Kroah-Hartman
2013-06-11 20:02 ` [ 14/79] USB: iuu_phoenix: fix bulk-message timeout Greg Kroah-Hartman
2013-06-11 20:02 ` [ 15/79] USB: keyspan: fix bogus array index Greg Kroah-Hartman
2013-06-11 20:02 ` [ 16/79] USB: ark3116: fix control-message timeout Greg Kroah-Hartman
2013-06-11 20:02 ` [ 17/79] USB: visor: fix initialisation of Treo/Kyocera devices Greg Kroah-Hartman
2013-06-11 20:02 ` [ 18/79] USB: zte_ev: fix control-message timeouts Greg Kroah-Hartman
2013-06-11 20:02 ` [ 19/79] USB: zte_ev: fix broken open Greg Kroah-Hartman
2013-06-11 20:02 ` [ 20/79] USB: Serial: cypress_M8: Enable FRWD Dongle hidcom device Greg Kroah-Hartman
2013-06-11 20:02 ` [ 21/79] USB: whiteheat: fix broken port configuration Greg Kroah-Hartman
2013-06-11 20:02 ` [ 22/79] USB: serial: fix Treo/Kyocera interrrupt-in urb context Greg Kroah-Hartman
2013-06-11 20:02 ` [ 23/79] USB: revert periodic scheduling bugfix Greg Kroah-Hartman
2013-06-11 20:02 ` [ 24/79] USB: mos7840: fix DMA to stack Greg Kroah-Hartman
2013-06-11 20:02 ` [ 25/79] USB: mos7720: " Greg Kroah-Hartman
2013-06-11 20:02 ` [ 26/79] USB: mos7720: fix message timeouts Greg Kroah-Hartman
2013-06-11 20:02 ` [ 27/79] USB: mos7720: fix hardware flow control Greg Kroah-Hartman
2013-06-11 20:02 ` [ 28/79] acpi-cpufreq: set current frequency based on target P-State Greg Kroah-Hartman
2013-06-11 20:02 ` [ 29/79] ACPI / video: ignore BIOS initial backlight value for HP m4 Greg Kroah-Hartman
2013-06-11 20:02 ` [ 30/79] ACPI / video: ignore BIOS initial backlight value for HP Pavilion g6 Greg Kroah-Hartman
2013-06-11 20:02 ` [ 31/79] ACPI / scan: do not match drivers against objects having scan handlers Greg Kroah-Hartman
2013-06-11 20:02 ` [ 32/79] ACPI / PM: Do not execute _PS0 for devices without _PSC during initialization Greg Kroah-Hartman
2013-06-11 20:02 ` [ 33/79] x86 / platform / hp_wmi: Fix bluetooth_rfkill misuse in hp_wmi_rfkill_setup() Greg Kroah-Hartman
2013-06-11 20:03 ` [ 34/79] ALSA: hda/via - Disable broken dynamic power control Greg Kroah-Hartman
2013-06-11 20:03 ` [ 35/79] ALSA: hda/via - Fix wrongly cleared pins after suspend on VT1802 Greg Kroah-Hartman
2013-06-11 20:03 ` [ 36/79] ALSA: hda - Allow setting automute/automic hooks after parsing Greg Kroah-Hartman
2013-06-11 20:03 ` [ 37/79] ALSA: hda - Add keep_eapd_on flag to generic parser Greg Kroah-Hartman
2013-06-11 20:03 ` [ 38/79] ARM: Kirkwood: TS219: Fix crash by double PCIe instantiation Greg Kroah-Hartman
2013-06-11 20:03 ` [ 39/79] ARM: 7742/1: topology: export cpu_topology Greg Kroah-Hartman
2013-06-11 20:03 ` [ 40/79] ARM: 7743/1: compressed/head.S: work around new binutils warning Greg Kroah-Hartman
2013-06-11 20:03 ` [ 41/79] ARM: 7747/1: pcpu: ensure __my_cpu_offset cannot be re-ordered across barrier() Greg Kroah-Hartman
2013-06-11 20:03 ` [ 42/79] powerpc/eeh: Dont check RTAS token to get PE addr Greg Kroah-Hartman
2013-06-11 20:03 ` [ 43/79] powerpc/hw_breakpoints: Add DABRX cpu feature to fix 32-bit regression Greg Kroah-Hartman
2013-06-11 20:03 ` [ 44/79] powerpc/perf: Fix deadlock caused by calling printk() in PMU exception Greg Kroah-Hartman
2013-06-11 20:03 ` [ 45/79] dmaengine: ste_dma40: fix pm runtime ref counting Greg Kroah-Hartman
2013-06-11 20:03 ` [ 46/79] radeon: Fix system hang issue when using KMS with older cards Greg Kroah-Hartman
2013-06-11 20:03 ` [ 47/79] drm/radeon: dont allow audio on DCE6 Greg Kroah-Hartman
2013-06-11 20:03 ` [ 48/79] hpfs: fix warnings when the filesystem fills up Greg Kroah-Hartman
2013-06-11 20:03 ` [ 49/79] cifs: fix off-by-one bug in build_unc_path_to_root Greg Kroah-Hartman
2013-06-11 20:03 ` [ 50/79] ecryptfs: fixed msync to flush data Greg Kroah-Hartman
2013-06-11 20:03 ` [ 51/79] eCryptfs: Check return of filemap_write_and_wait during fsync Greg Kroah-Hartman
2013-06-11 20:03 ` [ 52/79] hwmon: (adm1021) Strengthen chip detection for ADM1021, LM84 and MAX1617 Greg Kroah-Hartman
2013-06-11 20:03 ` [ 53/79] drm/mgag200: Add missing write to index before accessing data register Greg Kroah-Hartman
2013-06-11 20:03 ` Greg Kroah-Hartman [this message]
2013-06-11 20:03 ` [ 55/79] drm/i915/sdvo: Use &intel_sdvo->ddc instead of intel_sdvo->i2c for DDC Greg Kroah-Hartman
2013-06-11 20:03 ` [ 56/79] drm/i915: no lvds quirk for hp t5740 Greg Kroah-Hartman
2013-06-11 20:03 ` [ 57/79] drm/i915: Fix spurious -EIO/SIGBUS on wedged gpus Greg Kroah-Hartman
2013-06-11 20:03 ` [ 58/79] Revert "ACPI / scan: do not match drivers against objects having scan handlers" Greg Kroah-Hartman
2013-06-11 20:03 ` [ 59/79] powerpc: Fix build error in stable/3.9 Greg Kroah-Hartman
2013-06-11 20:03 ` [ 60/79] usb: dwc3: gadget: free trb pool only from epnum 2 Greg Kroah-Hartman
2013-06-11 20:03 ` [ 61/79] drm/gma500: Increase max resolution for mode setting Greg Kroah-Hartman
2013-06-11 20:03 ` [ 62/79] pci: Set dev->dev.type in alloc_pci_dev Greg Kroah-Hartman
2013-06-11 20:03 ` [ 63/79] powerpc: Set default VGA device Greg Kroah-Hartman
2013-06-11 20:03 ` [ 64/79] powerpc/pseries: Force 32 bit MSIs for devices that require it Greg Kroah-Hartman
2013-06-11 20:03 ` [ 65/79] powerpc/pseries: Make 32-bit MSI quirk work on systems lacking firmware support Greg Kroah-Hartman
2013-06-12 17:19   ` Kleber Sacilotto de Souza
2013-06-11 20:03 ` [ 66/79] powerpc/pseries: Perform proper max_bus_speed detection Greg Kroah-Hartman
2013-06-11 20:03 ` [ 67/79] radeon: use max_bus_speed to activate gen2 speeds Greg Kroah-Hartman
2013-06-11 20:03 ` [ 68/79] iio:inkern: Fix typo/bug in convert raw to processed Greg Kroah-Hartman
2013-06-11 20:03 ` [ 69/79] iio: frequency: ad4350: Fix bug / typo in mask Greg Kroah-Hartman
2013-06-11 20:03 ` [ 70/79] drm/i915: force full modeset if the connector is in DPMS OFF mode Greg Kroah-Hartman
2013-06-11 20:03 ` [ 71/79] USB: serial: add wait_until_sent operation Greg Kroah-Hartman
2013-06-11 20:03 ` [ 72/79] USB: serial: add generic wait_until_sent implementation Greg Kroah-Hartman
2013-06-11 20:03 ` [ 73/79] USB: ftdi_sio: clean up get_modem_status Greg Kroah-Hartman
2013-06-11 20:03 ` [ 74/79] USB: ftdi_sio: fix chars_in_buffer overhead Greg Kroah-Hartman
2013-06-11 20:03 ` [ 75/79] USB: io_ti: " Greg Kroah-Hartman
2013-06-11 20:03 ` [ 76/79] Fix lockup related to stop_machine being stuck in __do_softirq Greg Kroah-Hartman
2013-06-11 20:03 ` [ 77/79] xen/smp: Fixup NOHZ per cpu data when onlining an offline CPU Greg Kroah-Hartman
2013-06-11 20:03 ` [ 78/79] timekeeping: Correct run-time detection of persistent_clock Greg Kroah-Hartman
2013-06-11 20:03 ` [ 79/79] s390: Add pgste to ptep_modify_prot_start() Greg Kroah-Hartman
2013-06-12 14:06 ` [ 00/79] 3.9.6-stable review Guenter Roeck
2013-06-12 14:15   ` Josh Boyer
2013-06-12 14:21     ` Guenter Roeck
2013-06-12 15:49 ` Shuah Khan
2013-06-12 16:58   ` Greg Kroah-Hartman
2013-06-12 20:29 ` Guenter Roeck
2013-06-12 20:34   ` Guenter Roeck
2013-06-12 20:53     ` Kleber Sacilotto de Souza
2013-06-13 17:41       ` Greg Kroah-Hartman
2013-06-13 17:45         ` Greg Kroah-Hartman

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=20130611195323.215611167@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=airlied@gmail.com \
    --cc=chenhc@lemote.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michel.daenzer@amd.com \
    --cc=paulepanter@users.sourceforge.net \
    --cc=stable@vger.kernel.org \
    --cc=zhoubb@lemote.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