Skip to content

Commit

Permalink
drm/i915: Fix use-before-null-check in i915_irq_emit().
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
anholt authored and airlied committed Mar 2, 2009
1 parent fda714c commit 299eb93
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/gpu/drm/i915/i915_irq.c
Expand Up @@ -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);
Expand Down

0 comments on commit 299eb93

Please sign in to comment.