Merge tag 'drm-misc-next-fixes-2018-06-15' of git://anongit.freedesktop.org/drm/drm...
authorDave Airlie <airlied@redhat.com>
Wed, 20 Jun 2018 06:57:41 +0000 (16:57 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 20 Jun 2018 06:58:31 +0000 (16:58 +1000)
Single fix for v4.18:
- Fix possible race conditions while unplugging DRM device.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1fd8b7d1-e60a-0105-dfb5-d36f99ea0239@linux.intel.com
1  2 
drivers/gpu/drm/drm_drv.c

index b553a6f2ff0eb27dec7ad0aaeeb891992fe19ab8,cc2675550e280a0823acdf4e54c2cbfdfe169534..7af748ed1c58dddfae7cb578760be3344273901c
@@@ -369,13 -369,6 +369,6 @@@ EXPORT_SYMBOL(drm_dev_exit)
   */
  void drm_dev_unplug(struct drm_device *dev)
  {
-       drm_dev_unregister(dev);
-       mutex_lock(&drm_global_mutex);
-       if (dev->open_count == 0)
-               drm_dev_put(dev);
-       mutex_unlock(&drm_global_mutex);
        /*
         * After synchronizing any critical read section is guaranteed to see
         * the new value of ->unplugged, and any critical section which might
         */
        dev->unplugged = true;
        synchronize_srcu(&drm_unplug_srcu);
+       drm_dev_unregister(dev);
+       mutex_lock(&drm_global_mutex);
+       if (dev->open_count == 0)
+               drm_dev_put(dev);
+       mutex_unlock(&drm_global_mutex);
  }
  EXPORT_SYMBOL(drm_dev_unplug);
  
@@@ -756,7 -756,7 +756,7 @@@ static void remove_compat_control_link(
        if (!minor)
                return;
  
 -      name = kasprintf(GFP_KERNEL, "controlD%d", minor->index);
 +      name = kasprintf(GFP_KERNEL, "controlD%d", minor->index + 64);
        if (!name)
                return;