diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2015-08-27 13:06:24 -0400 |
---|---|---|
committer | Thomas Hellstrom <thellstrom@vmware.com> | 2015-09-01 05:06:02 -0400 |
commit | aa3469ce7afd86a670d22375a64f1b5a06707725 (patch) | |
tree | f36aae88ccb3d764e8ecd4e1e168fcd00ff0e43b | |
parent | 36d4e87b497d9cb3bf8e1bb2f803c7aa41dfb463 (diff) |
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>
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 6 |
2 files changed, 12 insertions, 1 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 03854d606d58..e13b20bd9908 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | |||
@@ -1052,10 +1052,15 @@ static struct vmw_master *vmw_master_check(struct drm_device *dev, | |||
1052 | } | 1052 | } |
1053 | 1053 | ||
1054 | /* | 1054 | /* |
1055 | * Check if we were previously master, but now dropped. | 1055 | * Check if we were previously master, but now dropped. In that |
1056 | * case, allow at least render node functionality. | ||
1056 | */ | 1057 | */ |
1057 | if (vmw_fp->locked_master) { | 1058 | if (vmw_fp->locked_master) { |
1058 | mutex_unlock(&dev->master_mutex); | 1059 | mutex_unlock(&dev->master_mutex); |
1060 | |||
1061 | if (flags & DRM_RENDER_ALLOW) | ||
1062 | return NULL; | ||
1063 | |||
1059 | DRM_ERROR("Dropped master trying to access ioctl that " | 1064 | DRM_ERROR("Dropped master trying to access ioctl that " |
1060 | "requires authentication.\n"); | 1065 | "requires authentication.\n"); |
1061 | return ERR_PTR(-EACCES); | 1066 | return ERR_PTR(-EACCES); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c index 5b8595b78429..3361769842f4 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | |||
@@ -911,6 +911,12 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv, | |||
911 | "surface reference.\n"); | 911 | "surface reference.\n"); |
912 | return -EACCES; | 912 | return -EACCES; |
913 | } | 913 | } |
914 | if (ACCESS_ONCE(vmw_fpriv(file_priv)->locked_master)) { | ||
915 | DRM_ERROR("Locked master refused legacy " | ||
916 | "surface reference.\n"); | ||
917 | return -EACCES; | ||
918 | } | ||
919 | |||
914 | handle = u_handle; | 920 | handle = u_handle; |
915 | } | 921 | } |
916 | 922 | ||