drm-misc-fixes for v7.2-rc3: - Fix uaf in amdxdna mmap failure path. - A lot of deadlocks, access races and return value fixes in amdxdna. - Fix analogix_dp bitshifts during link training. - Use direct label in drm_exec. - Fix absent indirect bo handling in v3d. - Sync on first active crtc in fb_dirty, rather than first crtc. - Rework try_harder in the buddy allocator. - Make imagination function static to solve compiler warning. - Fix imagination error checking.
Showing the changes to include (1 of 16 files). Show all
Unified · Split
| @@ -101,17 +101,6 @@ drm_exec_obj(struct drm_exec *exec, unsigned long index) · 100 unmodified lines | ||
| 101 | 101 | #define drm_exec_for_each_locked_object_reverse(exec, obj) \ |
| 102 | 102 | __drm_exec_for_each_locked_object_reverse(exec, obj, __UNIQUE_ID(drm_exec)) |
| 103 | 103 | |
| 104 | −/* | |
| 105 | − * Helper to drm_exec_until_all_locked(). Don't use directly. | |
| 106 | − * | |
| 107 | − * Since labels can't be defined local to the loop's body we use a jump pointer | |
| 108 | − * to make sure that the retry is only used from within the loop's body. | |
| 109 | − */ | |
| 110 | −#define __drm_exec_until_all_locked(exec, _label) \ | |
| 111 | −_label: \ | |
| 112 | − for (void *const __maybe_unused __drm_exec_retry_ptr = &&_label; \ | |
| 113 | − drm_exec_cleanup(exec);) | |
| 114 | − | |
| 115 | 104 | /** |
| 116 | 105 | * drm_exec_until_all_locked - loop until all GEM objects are locked |
| 117 | 106 | * @exec: drm_exec object |
| @@ -119,9 +108,18 @@ _label: \ · 1 unmodified line | ||
| 119 | 108 | * Core functionality of the drm_exec object. Loops until all GEM objects are |
| 120 | 109 | * locked and no more contention exists. At the beginning of the loop it is |
| 121 | 110 | * guaranteed that no GEM object is locked. |
| 111 | + * | |
| 112 | + * A global label name drm_exec_retry is used, if you need to use more than one | |
| 113 | + * instance of this macro in the same function the label needs to be made local | |
| 114 | + * to the block with the __label__ keyword. | |
| 122 | 115 | */ |
| 123 | 116 | #define drm_exec_until_all_locked(exec) \ |
| 124 | − __drm_exec_until_all_locked(exec, __UNIQUE_ID(drm_exec)) | |
| 117 | + for (bool const __maybe_unused __drm_exec_loop = false; \ | |
| 118 | + drm_exec_cleanup(exec);) \ | |
| 119 | + if (false) { \ | |
| 120 | +drm_exec_retry: __maybe_unused; \ | |
| 121 | + continue; \ | |
| 122 | + } else | |
| 125 | 123 | |
| 126 | 124 | /** |
| 127 | 125 | * drm_exec_retry_on_contention - restart the loop to grap all locks |
| @@ -129,12 +127,14 @@ _label: \ · 1 unmodified line | ||
| 129 | 127 | * |
| 130 | 128 | * Control flow helper to continue when a contention was detected and we need to |
| 131 | 129 | * clean up and re-start the loop to prepare all GEM objects. |
| 130 | + * The __drm_exec_loop check exists to prevent usage outside of an | |
| 131 | + * drm_exec_until_all_locked() loop. | |
| 132 | 132 | */ |
| 133 | 133 | #define drm_exec_retry_on_contention(exec) \ |
| 134 | 134 | do { \ |
| 135 | 135 | if (unlikely(drm_exec_is_contended(exec))) \ |
| 136 | − goto *__drm_exec_retry_ptr; \ | |
| 137 | − } while (0) | |
| 136 | + goto drm_exec_retry; \ | |
| 137 | + } while (__drm_exec_loop) | |
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | 140 | * drm_exec_is_contended - check for contention |
| @@ -154,12 +154,14 @@ static inline bool drm_exec_is_contended(struct drm_exec *exec) · 13 unmodified lines | ||
| 154 | 154 | * |
| 155 | 155 | * Unconditionally retry the loop to lock all objects. For consistency, |
| 156 | 156 | * the exec object needs to be newly initialized. |
| 157 | + * The __drm_exec_loop check exists to prevent usage outside of an | |
| 158 | + * drm_exec_until_all_locked() loop. | |
| 157 | 159 | */ |
| 158 | 160 | #define drm_exec_retry(_exec) \ |
| 159 | 161 | do { \ |
| 160 | 162 | WARN_ON((_exec)->contended != DRM_EXEC_DUMMY); \ |
| 161 | − goto *__drm_exec_retry_ptr; \ | |
| 162 | − } while (0) | |
| 163 | + goto drm_exec_retry; \ | |
| 164 | + } while (__drm_exec_loop) | |
| 163 | 165 | |
| 164 | 166 | /** |
| 165 | 167 | * drm_exec_ticket - return the ww_acquire_ctx for this exec context |