History

drm/i915: Reject unknown syncobj flags

We have to reject unknown flags for uAPI considerations, and also because the curent implementation limits their i915 storage space to two bits. v2: (Chris Wilson) * Fix fail in ABI check. * Added unknown flags and BUILD_BUG_ON. v3: * Use ARCH_KMALLOC_MINALIGN instead of alignof. (Chris Wilson)

Tvrtko Ursulin committed 9 years ago

Commit ebcaa1f1 parent 49e43ef2 files · +9 −0Browse files

Unified · Split

2 files
  1. drivers/gpu/drm/i915/i915_gem_execbuffer.c +8 −0
  2. include/uapi/drm/i915_drm.h +1 −0
drivers/gpu/drm/i915/i915_gem_execbuffer.c+8−0
@@ -2104,6 +2104,11 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args, · 2103 unmodified lines
2104 goto err;2104 goto err;
2105 }2105 }
2106 2106
2107 if (fence.flags & __I915_EXEC_FENCE_UNKNOWN_FLAGS) {
2108 err = -EINVAL;
2109 goto err;
2110 }
2111
2107 syncobj = drm_syncobj_find(file, fence.handle);2112 syncobj = drm_syncobj_find(file, fence.handle);
2108 if (!syncobj) {2113 if (!syncobj) {
2109 DRM_DEBUG("Invalid syncobj handle provided\n");2114 DRM_DEBUG("Invalid syncobj handle provided\n");
@@ -2111,6 +2116,9 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args, · 1 unmodified line
2111 goto err;2116 goto err;
2112 }2117 }
2113 2118
2119 BUILD_BUG_ON(~(ARCH_KMALLOC_MINALIGN - 1) &
2120 ~__I915_EXEC_FENCE_UNKNOWN_FLAGS);
2121
2114 fences[n] = ptr_pack_bits(syncobj, fence.flags, 2);2122 fences[n] = ptr_pack_bits(syncobj, fence.flags, 2);
2115 }2123 }
2116 2124
include/uapi/drm/i915_drm.h+1−0
@@ -839,6 +839,7 @@ struct drm_i915_gem_exec_fence { · 838 unmodified lines
839 839
840#define I915_EXEC_FENCE_WAIT (1<<0)840#define I915_EXEC_FENCE_WAIT (1<<0)
841#define I915_EXEC_FENCE_SIGNAL (1<<1)841#define I915_EXEC_FENCE_SIGNAL (1<<1)
842#define __I915_EXEC_FENCE_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SIGNAL << 1))
842 __u32 flags;843 __u32 flags;
843};844};
844 845

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t