Ver Fonte

drm/msm: Verify that MSM_SUBMIT_BO_FLAGS are set

For every submission buffer object one of MSM_SUBMIT_BO_WRITE
and MSM_SUBMIT_BO_READ must be set (and nothing else). If we
allowed zero then the buffer object would never get queued to
be unreferenced.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Jordan Crouse há 8 anos atrás
pai
commit
a6cb3b864b
1 ficheiros alterados com 2 adições e 1 exclusões
  1. 2 1
      drivers/gpu/drm/msm/msm_gem_submit.c

+ 2 - 1
drivers/gpu/drm/msm/msm_gem_submit.c

@@ -106,7 +106,8 @@ static int submit_lookup_objects(struct msm_gem_submit *submit,
 			pagefault_disable();
 			pagefault_disable();
 		}
 		}
 
 
-		if (submit_bo.flags & ~MSM_SUBMIT_BO_FLAGS) {
+		if ((submit_bo.flags & ~MSM_SUBMIT_BO_FLAGS) ||
+			!(submit_bo.flags & MSM_SUBMIT_BO_FLAGS)) {
 			DRM_ERROR("invalid flags: %x\n", submit_bo.flags);
 			DRM_ERROR("invalid flags: %x\n", submit_bo.flags);
 			ret = -EINVAL;
 			ret = -EINVAL;
 			goto out_unlock;
 			goto out_unlock;