diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2017-06-22 12:02:11 -0400 |
---|---|---|
committer | Jani Nikula <jani.nikula@intel.com> | 2017-07-10 03:33:03 -0400 |
commit | 7581d5ca2bb269cfc2ce2d0cb489aac513167f6b (patch) | |
tree | e2008a10d5fad5fa155dcc9b3459a6c41200f6d5 | |
parent | 04941829b0049d2446c7042ab9686dd057d809a6 (diff) |
drm/i915/fbdev: Check for existence of ifbdev->vma before operations
Commit fabef825626d ("drm/i915: Drop struct_mutex around frontbuffer
flushes") adds a dependency to ifbdev->vma when flushing the framebufer,
but the checks are only against the existence of the ifbdev->fb and not
against ifbdev->vma. This leaves a window of opportunity where we may
try to operate on the fbdev prior to it being probed (thanks to
asynchronous booting).
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101534
Fixes: fabef825626d ("drm/i915: Drop struct_mutex around frontbuffer flushes")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170622160211.783-1-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: stable@vger.kernel.org
(cherry picked from commit 15727ed0d944ce1dec8b9e1082dd3df29a0fdf44)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
-rw-r--r-- | drivers/gpu/drm/i915/intel_fbdev.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index 03347c6ae599..0c4cde6b2e6f 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c | |||
@@ -535,13 +535,14 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev) | |||
535 | 535 | ||
536 | drm_fb_helper_fini(&ifbdev->helper); | 536 | drm_fb_helper_fini(&ifbdev->helper); |
537 | 537 | ||
538 | if (ifbdev->fb) { | 538 | if (ifbdev->vma) { |
539 | mutex_lock(&ifbdev->helper.dev->struct_mutex); | 539 | mutex_lock(&ifbdev->helper.dev->struct_mutex); |
540 | intel_unpin_fb_vma(ifbdev->vma); | 540 | intel_unpin_fb_vma(ifbdev->vma); |
541 | mutex_unlock(&ifbdev->helper.dev->struct_mutex); | 541 | mutex_unlock(&ifbdev->helper.dev->struct_mutex); |
542 | } | ||
542 | 543 | ||
544 | if (ifbdev->fb) | ||
543 | drm_framebuffer_remove(&ifbdev->fb->base); | 545 | drm_framebuffer_remove(&ifbdev->fb->base); |
544 | } | ||
545 | 546 | ||
546 | kfree(ifbdev); | 547 | kfree(ifbdev); |
547 | } | 548 | } |
@@ -765,7 +766,7 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous | |||
765 | struct intel_fbdev *ifbdev = dev_priv->fbdev; | 766 | struct intel_fbdev *ifbdev = dev_priv->fbdev; |
766 | struct fb_info *info; | 767 | struct fb_info *info; |
767 | 768 | ||
768 | if (!ifbdev || !ifbdev->fb) | 769 | if (!ifbdev || !ifbdev->vma) |
769 | return; | 770 | return; |
770 | 771 | ||
771 | info = ifbdev->helper.fbdev; | 772 | info = ifbdev->helper.fbdev; |
@@ -812,7 +813,7 @@ void intel_fbdev_output_poll_changed(struct drm_device *dev) | |||
812 | { | 813 | { |
813 | struct intel_fbdev *ifbdev = to_i915(dev)->fbdev; | 814 | struct intel_fbdev *ifbdev = to_i915(dev)->fbdev; |
814 | 815 | ||
815 | if (ifbdev && ifbdev->fb) | 816 | if (ifbdev && ifbdev->vma) |
816 | drm_fb_helper_hotplug_event(&ifbdev->helper); | 817 | drm_fb_helper_hotplug_event(&ifbdev->helper); |
817 | } | 818 | } |
818 | 819 | ||
@@ -824,7 +825,7 @@ void intel_fbdev_restore_mode(struct drm_device *dev) | |||
824 | return; | 825 | return; |
825 | 826 | ||
826 | intel_fbdev_sync(ifbdev); | 827 | intel_fbdev_sync(ifbdev); |
827 | if (!ifbdev->fb) | 828 | if (!ifbdev->vma) |
828 | return; | 829 | return; |
829 | 830 | ||
830 | if (drm_fb_helper_restore_fbdev_mode_unlocked(&ifbdev->helper) == 0) | 831 | if (drm_fb_helper_restore_fbdev_mode_unlocked(&ifbdev->helper) == 0) |