61 lines
2.0 KiB
Diff
61 lines
2.0 KiB
Diff
From a19afebb883f2a02ecf4b8d5a114ce6957a59238 Mon Sep 17 00:00:00 2001
|
|
From: Thomas Hellstrom <thellstrom@vmware.com>
|
|
Date: Wed, 26 Aug 2015 05:49:21 -0700
|
|
Subject: [PATCH 2/2] drm/vmwgfx: Allow dropped masters render-node like access
|
|
on legacy nodes v2
|
|
|
|
Applications like gnome-shell may try to render after dropping master
|
|
privileges. Since the driver should now be safe against this scenario,
|
|
allow those applications to use their legacy node like a render node.
|
|
|
|
v2: Add missing return statement.
|
|
|
|
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
|
|
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
|
|
---
|
|
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 7 ++++++-
|
|
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 6 ++++++
|
|
2 files changed, 12 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
|
|
index a4766acd0ea2..d022b509f1ac 100644
|
|
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
|
|
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
|
|
@@ -993,10 +993,15 @@ static struct vmw_master *vmw_master_check(struct drm_device *dev,
|
|
}
|
|
|
|
/*
|
|
- * Check if we were previously master, but now dropped.
|
|
+ * Check if we were previously master, but now dropped. In that
|
|
+ * case, allow at least render node functionality.
|
|
*/
|
|
if (vmw_fp->locked_master) {
|
|
mutex_unlock(&dev->master_mutex);
|
|
+
|
|
+ if (flags & DRM_RENDER_ALLOW)
|
|
+ return NULL;
|
|
+
|
|
DRM_ERROR("Dropped master trying to access ioctl that "
|
|
"requires authentication.\n");
|
|
return ERR_PTR(-EACCES);
|
|
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
|
|
index 4d0c98edeb6a..7fc3e8abd0c4 100644
|
|
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
|
|
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
|
|
@@ -906,6 +906,12 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
|
|
"surface reference.\n");
|
|
return -EACCES;
|
|
}
|
|
+ if (ACCESS_ONCE(vmw_fpriv(file_priv)->locked_master)) {
|
|
+ DRM_ERROR("Locked master refused legacy "
|
|
+ "surface reference.\n");
|
|
+ return -EACCES;
|
|
+ }
|
|
+
|
|
handle = u_handle;
|
|
}
|
|
|
|
--
|
|
2.4.3
|
|
|