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
21042104 goto err;
21052105 }
21062106
2107+ if (fence.flags & __I915_EXEC_FENCE_UNKNOWN_FLAGS) {
2108+ err = -EINVAL;
2109+ goto err;
2110+ }
2111+
21072112 syncobj = drm_syncobj_find(file, fence.handle);
21082113 if (!syncobj) {
21092114 DRM_DEBUG("Invalid syncobj handle provided\n");
@@ -2111,6 +2116,9 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args, · 1 unmodified line
21112116 goto err;
21122117 }
21132118
2119+ BUILD_BUG_ON(~(ARCH_KMALLOC_MINALIGN - 1) &
2120+ ~__I915_EXEC_FENCE_UNKNOWN_FLAGS);
2121+
21142122 fences[n] = ptr_pack_bits(syncobj, fence.flags, 2);
21152123 }
21162124
include/uapi/drm/i915_drm.h+1−0
@@ -839,6 +839,7 @@ struct drm_i915_gem_exec_fence { · 838 unmodified lines
839839
840840 #define I915_EXEC_FENCE_WAIT (1<<0)
841841 #define I915_EXEC_FENCE_SIGNAL (1<<1)
842+#define __I915_EXEC_FENCE_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SIGNAL << 1))
842843 __u32 flags;
843844 };
844845

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