summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2014-01-24 04:43:57 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2014-01-24 04:43:57 +0000
commit85480668fe4729431215d4c46acc07b3e212dace (patch)
tree81489e44f7241291161d5e4b82ce43ff2da80411
parentf07ad0d33aa01e69091abddfec2a8b8e85446169 (diff)
drm: fix a use-after-free when GPU acceleration disabled
From Huacai Chen efe4df2ae6302d6fdbb7b460d8747fe50e2aa4d0 in ubuntu 3.8 b7ea85a4fed37835eec78a7be3039c8dc22b8178 in mainline linux
-rw-r--r--sys/dev/pci/drm/drm_irq.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/drm_irq.c b/sys/dev/pci/drm/drm_irq.c
index f7846aa5e40..1cb8f517026 100644
--- a/sys/dev/pci/drm/drm_irq.c
+++ b/sys/dev/pci/drm/drm_irq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_irq.c,v 1.52 2013/10/29 06:30:57 jsg Exp $ */
+/* $OpenBSD: drm_irq.c,v 1.53 2014/01/24 04:43:56 jsg Exp $ */
/**
* \file drm_irq.c
* IRQ support
@@ -1075,7 +1075,7 @@ void drm_vblank_off(struct drm_device *dev, int crtc)
*/
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;
/*
@@ -1095,6 +1095,10 @@ EXPORT_SYMBOL(drm_vblank_pre_modeset);
void drm_vblank_post_modeset(struct drm_device *dev, int crtc)
{
+ /* vblank is not initialized (IRQ not installed ?), or has been freed */
+ if (!dev->num_crtcs)
+ return;
+
if (dev->vblank_inmodeset[crtc]) {
mtx_enter(&dev->vbl_lock);
dev->vblank_disable_allowed = 1;