Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+11 -6
+11 -6
drivers/gpu/drm/i915/intel_display.c
··· 1016 1016 1017 1017 if (bo->size < width * height * 4) { 1018 1018 DRM_ERROR("buffer is to small\n"); 1019 - drm_gem_object_unreference(bo); 1020 - return -ENOMEM; 1019 + ret = -ENOMEM; 1020 + goto fail; 1021 1021 } 1022 1022 1023 1023 /* we only need to pin inside GTT if cursor is non-phy */ ··· 1025 1025 ret = i915_gem_object_pin(bo, PAGE_SIZE); 1026 1026 if (ret) { 1027 1027 DRM_ERROR("failed to pin cursor bo\n"); 1028 - drm_gem_object_unreference(bo); 1029 - return ret; 1028 + goto fail; 1030 1029 } 1031 1030 addr = obj_priv->gtt_offset; 1032 1031 } else { 1033 1032 ret = i915_gem_attach_phys_object(dev, bo, (pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1); 1034 1033 if (ret) { 1035 1034 DRM_ERROR("failed to attach phys object\n"); 1036 - drm_gem_object_unreference(bo); 1037 - return ret; 1035 + goto fail; 1038 1036 } 1039 1037 addr = obj_priv->phys_obj->handle->busaddr; 1040 1038 } ··· 1052 1054 i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo); 1053 1055 } else 1054 1056 i915_gem_object_unpin(intel_crtc->cursor_bo); 1057 + mutex_lock(&dev->struct_mutex); 1055 1058 drm_gem_object_unreference(intel_crtc->cursor_bo); 1059 + mutex_unlock(&dev->struct_mutex); 1056 1060 } 1057 1061 1058 1062 intel_crtc->cursor_addr = addr; 1059 1063 intel_crtc->cursor_bo = bo; 1060 1064 1061 1065 return 0; 1066 + fail: 1067 + mutex_lock(&dev->struct_mutex); 1068 + drm_gem_object_unreference(bo); 1069 + mutex_unlock(&dev->struct_mutex); 1070 + return ret; 1062 1071 } 1063 1072 1064 1073 static int intel_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)