summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-08-15 13:42:04 -0700
committerEric Anholt <eric@anholt.net>2007-08-15 13:42:04 -0700
commit6e93c35ba7c5001e756d0c9d1a4f534384652a5a (patch)
tree69126deafe1fec7808ea48b18b0294f3c35c02a9
parent9254e00e4bbbc02282415cd0ca7bd6b5cb52be82 (diff)
BSD: Return EINVAL if drm_unlock is called on an unheld or other-owner lock.
-rw-r--r--bsd-core/drm_lock.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/bsd-core/drm_lock.c b/bsd-core/drm_lock.c
index 326c083b..fb86fc68 100644
--- a/bsd-core/drm_lock.c
+++ b/bsd-core/drm_lock.c
@@ -173,6 +173,12 @@ int drm_unlock(drm_device_t *dev, void *data, struct drm_file *file_priv)
DRM_CURRENTPID, lock->context);
return EINVAL;
}
+ /* Check that the context unlock being requested actually matches
+ * who currently holds the lock.
+ */
+ if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) ||
+ _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) != lock->context)
+ return EINVAL;
atomic_inc(&dev->counts[_DRM_STAT_UNLOCKS]);