diff options
-rw-r--r-- | linux-core/drm_fops.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/linux-core/drm_fops.c b/linux-core/drm_fops.c index 0ca43824..d5c59b19 100644 --- a/linux-core/drm_fops.c +++ b/linux-core/drm_fops.c @@ -488,13 +488,15 @@ int drm_release(struct inode *inode, struct file *filp) if (drm_core_check_feature(dev, DRIVER_MODESET)) drm_fb_release(filp); - file_priv->master = NULL; - if (file_priv->is_master) { - drm_put_master(file_priv->minor->master); - file_priv->minor->master = NULL; + if (file_priv->minor->master == file_priv->master) + file_priv->minor->master = NULL; + drm_put_master(file_priv->master); } + file_priv->master = NULL; + file_priv->is_master = 0; + mutex_lock(&dev->struct_mutex); drm_object_release(filp); if (file_priv->remove_auth_on_close == 1) { |