]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
drm/i915: Fix use-before-null-check in i915_irq_emit().
authorEric Anholt <eric@anholt.net>
Wed, 25 Feb 2009 06:14:12 +0000 (22:14 -0800)
committerDave Airlie <airlied@linux.ie>
Mon, 2 Mar 2009 23:53:05 +0000 (09:53 +1000)
This could be triggered by a client asking to emit an irq when the device
wasn't initialized.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@linux.ie>
drivers/gpu/drm/i915/i915_irq.c

index 548ff2c66431ee93a205b15d84362084da7486ce..87b6b603469ea278780af278fb9b7dc92d013ed0 100644 (file)
@@ -383,12 +383,13 @@ int i915_irq_emit(struct drm_device *dev, void *data,
        drm_i915_irq_emit_t *emit = data;
        int result;
 
-       RING_LOCK_TEST_WITH_RETURN(dev, file_priv);
-
        if (!dev_priv) {
                DRM_ERROR("called with no initialization\n");
                return -EINVAL;
        }
+
+       RING_LOCK_TEST_WITH_RETURN(dev, file_priv);
+
        mutex_lock(&dev->struct_mutex);
        result = i915_emit_irq(dev);
        mutex_unlock(&dev->struct_mutex);