Skip to contentSkip to conversation

drm/msm: Disallow submit with fence id 0

PATCH New Rob Clark 1 participant 1 message Jul 24, 2023

Subsystems (3)
lore
Share & tools
lore

Rob Clark

author
#0 lore raw

PATCH 1/1 drm/msm: Disallow submit with fence id 0

From: Rob Clark <[email protected]>

A fence id of zero is expected to be invalid, and is not removed from the fence_idr table. If userspace is requesting to specify the fence id with the FENCE_SN_IN flag, we need to reject a zero fence id value.

Fixes 17154addc5c1 ("drm/msm: Add MSM_SUBMIT_FENCE_SN_IN")
---
 drivers/gpu/drm/msm/msm_gem_submit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_gem_submit.c +1 -1
index 9d66498cdc04..63c96416e183 100644
@@ -901,7 +901,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
 	 * after the job is armed
 	 */
 	if ((args->flags & MSM_SUBMIT_FENCE_SN_IN) &&
-			idr_find(&queue->fence_idr, args->fence)) {
+			(!args->fence || idr_find(&queue->fence_idr, args->fence))) {
 		spin_unlock(&queue->idr_lock);
 		idr_preload_end();
 		ret = -EINVAL;
Signature · 1 line
2.41.0