Skip to content

Commit da168d8

Browse files
committed
drm: Reject DRI1 hw lock ioctl functions for kms drivers
I've done some extensive history digging across libdrm, mesa and xf86-video-{intel,nouveau,ati}. The only potential user of this with kms drivers I could find was ttmtest, which once used drmGetLock still. But that mistake was quickly fixed up. Even the intel xvmc library (which otherwise was really good with using dri1 stuff in kms mode) managed to never take the hw lock for dri2 (and hence kms). Hence it should be save to unconditionally disallow this. Cc: Peter Antoine <peter.antoine@intel.com> Reviewed-by: Peter Antoine <peter.antoine@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
1 parent ba6976c commit da168d8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/gpu/drm/drm_lock.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ int drm_legacy_lock(struct drm_device *dev, void *data,
6161
struct drm_master *master = file_priv->master;
6262
int ret = 0;
6363

64+
if (drm_core_check_feature(dev, DRIVER_MODESET))
65+
return -EINVAL;
66+
6467
++file_priv->lock_count;
6568

6669
if (lock->context == DRM_KERNEL_CONTEXT) {
@@ -153,6 +156,9 @@ int drm_legacy_unlock(struct drm_device *dev, void *data, struct drm_file *file_
153156
struct drm_lock *lock = data;
154157
struct drm_master *master = file_priv->master;
155158

159+
if (drm_core_check_feature(dev, DRIVER_MODESET))
160+
return -EINVAL;
161+
156162
if (lock->context == DRM_KERNEL_CONTEXT) {
157163
DRM_ERROR("Process %d using kernel context %d\n",
158164
task_pid_nr(current), lock->context);

0 commit comments

Comments
 (0)