mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2026-05-03 14:58:03 +02:00
Dont allow !sysadmin clients to alter the memory type of
NO_EVICT buffers.
This commit is contained in:
parent
88be276a42
commit
5bebcd7a0b
1 changed files with 14 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue