drm: fix fd closing ordering.

If the master fd goes away before the aiglx fd, we try and get a lock
that actually doesn't exist.
main
Dave Airlie 2008-03-12 14:48:01 +10:00
parent cf1a2499ed
commit 981f515e2b
1 changed files with 52 additions and 48 deletions

View File

@ -402,6 +402,8 @@ int drm_release(struct inode *inode, struct file *filp)
current->pid, (long)old_encode_dev(file_priv->minor->device),
dev->open_count);
/* if the master has gone away we can't do anything with the lock */
if (file_priv->minor->master) {
if (dev->driver->reclaim_buffers_locked && file_priv->master->lock.hw_lock) {
if (drm_i_have_hw_lock(dev, file_priv)) {
dev->driver->reclaim_buffers_locked(dev, file_priv);
@ -443,6 +445,7 @@ int drm_release(struct inode *inode, struct file *filp)
}
if (drm_i_have_hw_lock(dev, file_priv)) {
DRM_DEBUG("File %p released, freeing lock for context %d\n",
filp, _DRM_LOCKING_CONTEXT(file_priv->master->lock.hw_lock->lock));
@ -456,6 +459,7 @@ int drm_release(struct inode *inode, struct file *filp)
!dev->driver->reclaim_buffers_locked) {
dev->driver->reclaim_buffers(dev, file_priv);
}
}
drm_fasync(-1, filp, 0);