Don't free driver mapped locks
authorJesse Barnes <jesse.barnes@intel.com>
Tue, 4 Dec 2007 22:38:00 +0000 (14:38 -0800)
committerJesse Barnes <jesse.barnes@intel.com>
Tue, 4 Dec 2007 22:38:00 +0000 (14:38 -0800)
This fix is actually a bit of a cleanup too--it moves lock freeing to
drm_rmmap_locked and out of drm_lastclose.  This makes it symmetrical with
addmap and also prevents the lock from being incorrectly freed from driver
mappings.

linux-core/drm_bufs.c
linux-core/drm_drv.c

index bfd3dd3..967e9a2 100644 (file)
@@ -413,6 +413,8 @@ int drm_rmmap_locked(struct drm_device *dev, drm_local_map_t *map)
        case _DRM_SHM:
                vfree(map->handle);
                dev->sigdata.lock = dev->lock.hw_lock = NULL;   /* SHM removed */
+               dev->lock.file_priv = NULL;
+               wake_up_interruptible(&dev->lock.lock_queue);
                break;
        case _DRM_AGP:
        case _DRM_SCATTER_GATHER:
index 6a3e704..a88ae8b 100644 (file)
@@ -276,11 +276,6 @@ int drm_lastclose(struct drm_device * dev)
        if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
                drm_dma_takedown(dev);
 
-       if (dev->lock.hw_lock) {
-               dev->sigdata.lock = dev->lock.hw_lock = NULL;   /* SHM removed */
-               dev->lock.file_priv = NULL;
-               wake_up_interruptible(&dev->lock.lock_queue);
-       }
        dev->dev_mapping = NULL;
        mutex_unlock(&dev->struct_mutex);