drm/i915: lock correct mutex around object unreference.
This makes sure the mutex is held around the unreference. Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
@@ -1016,8 +1016,8 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
|
|||||||
|
|
||||||
if (bo->size < width * height * 4) {
|
if (bo->size < width * height * 4) {
|
||||||
DRM_ERROR("buffer is to small\n");
|
DRM_ERROR("buffer is to small\n");
|
||||||
drm_gem_object_unreference(bo);
|
ret = -ENOMEM;
|
||||||
return -ENOMEM;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we only need to pin inside GTT if cursor is non-phy */
|
/* we only need to pin inside GTT if cursor is non-phy */
|
||||||
@@ -1025,16 +1025,14 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
|
|||||||
ret = i915_gem_object_pin(bo, PAGE_SIZE);
|
ret = i915_gem_object_pin(bo, PAGE_SIZE);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
DRM_ERROR("failed to pin cursor bo\n");
|
DRM_ERROR("failed to pin cursor bo\n");
|
||||||
drm_gem_object_unreference(bo);
|
goto fail;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
addr = obj_priv->gtt_offset;
|
addr = obj_priv->gtt_offset;
|
||||||
} else {
|
} else {
|
||||||
ret = i915_gem_attach_phys_object(dev, bo, (pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1);
|
ret = i915_gem_attach_phys_object(dev, bo, (pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
DRM_ERROR("failed to attach phys object\n");
|
DRM_ERROR("failed to attach phys object\n");
|
||||||
drm_gem_object_unreference(bo);
|
goto fail;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
addr = obj_priv->phys_obj->handle->busaddr;
|
addr = obj_priv->phys_obj->handle->busaddr;
|
||||||
}
|
}
|
||||||
@@ -1054,13 +1052,20 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
|
|||||||
i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo);
|
i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo);
|
||||||
} else
|
} else
|
||||||
i915_gem_object_unpin(intel_crtc->cursor_bo);
|
i915_gem_object_unpin(intel_crtc->cursor_bo);
|
||||||
|
mutex_lock(&dev->struct_mutex);
|
||||||
drm_gem_object_unreference(intel_crtc->cursor_bo);
|
drm_gem_object_unreference(intel_crtc->cursor_bo);
|
||||||
|
mutex_unlock(&dev->struct_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
intel_crtc->cursor_addr = addr;
|
intel_crtc->cursor_addr = addr;
|
||||||
intel_crtc->cursor_bo = bo;
|
intel_crtc->cursor_bo = bo;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
fail:
|
||||||
|
mutex_lock(&dev->struct_mutex);
|
||||||
|
drm_gem_object_unreference(bo);
|
||||||
|
mutex_unlock(&dev->struct_mutex);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int intel_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
|
static int intel_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
|
||||||
|
Reference in New Issue
Block a user