diff options
author | Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> | 2008-03-12 10:19:36 +0100 |
---|---|---|
committer | Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> | 2008-03-12 10:19:36 +0100 |
commit | 5bebcd7a0b548b29a9859b2949b06662968cc868 (patch) | |
tree | a78ae596a2824a96d3aa32fc92de8d928c84f188 /linux-core/drm_bo.c | |
parent | 88be276a427124cc545a7d89b137e4ae6dd79acb (diff) |
Dont allow !sysadmin clients to alter the memory type of
NO_EVICT buffers.
Diffstat (limited to 'linux-core/drm_bo.c')
-rw-r--r-- | linux-core/drm_bo.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c index 2e210040..a94bd8a1 100644 --- a/linux-core/drm_bo.c +++ b/linux-core/drm_bo.c @@ -979,6 +979,20 @@ static int drm_bo_modify_proposed_flags (struct drm_buffer_object *bo, return -EPERM; } + if (likely(new_mask & DRM_BO_MASK_MEM) && + (bo->mem.flags & DRM_BO_FLAG_NO_EVICT) && + !DRM_SUSER(DRM_CURPROC)) { + if (likely(bo->mem.flags & new_flags & new_mask & + DRM_BO_MASK_MEM)) + new_flags = (new_flags & ~DRM_BO_MASK_MEM) | + (bo->mem.flags & DRM_BO_MASK_MEM); + else { + DRM_ERROR("Incompatible memory type specification " + "for NO_EVICT buffer.\n"); + return -EPERM; + } + } + if ((new_flags & DRM_BO_FLAG_NO_MOVE)) { DRM_ERROR("DRM_BO_FLAG_NO_MOVE is not properly implemented yet.\n"); return -EPERM; |