summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2020-11-14 09:24:45 +0000
committerkettenis <kettenis@openbsd.org>2020-11-14 09:24:45 +0000
commit54be36c577ccc6ed25a5a6f3987f6c565237665a (patch)
tree51b63ba51ea287e3ae26e67a0d8c7529c4cda21a
parentDelete unused #defines: T_USER hasn't been used since July 2018 (diff)
downloadwireguard-openbsd-54be36c577ccc6ed25a5a6f3987f6c565237665a.tar.xz
wireguard-openbsd-54be36c577ccc6ed25a5a6f3987f6c565237665a.zip
We should only grab the drm_global_mutex lock for legacy drivers.
Spotted thanks to debugging work by semarie@ ok jsg@, semarie@
-rw-r--r--sys/dev/pci/drm/drm_ioctl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/drm_ioctl.c b/sys/dev/pci/drm/drm_ioctl.c
index f9827335439..4db877d8ab1 100644
--- a/sys/dev/pci/drm/drm_ioctl.c
+++ b/sys/dev/pci/drm/drm_ioctl.c
@@ -1073,7 +1073,9 @@ drm_do_ioctl(struct drm_device *dev, int minor, u_long cmd, caddr_t data)
memcpy(adata, data, usize);
}
- if (ioctl->flags & DRM_UNLOCKED)
+ /* Enforce sane locking for modern driver ioctls. */
+ if (likely(!drm_core_check_feature(dev, DRIVER_LEGACY)) ||
+ (ioctl->flags & DRM_UNLOCKED))
retcode = func(dev, adata, file_priv);
else {
mutex_lock(&drm_global_mutex);