]> git.hungrycats.org Git - linux/commitdiff
drm/msm: Verify that MSM_SUBMIT_BO_FLAGS are set
authorJordan Crouse <jcrouse@codeaurora.org>
Tue, 20 Dec 2016 15:54:31 +0000 (08:54 -0700)
committerSasha Levin <alexander.levin@verizon.com>
Sun, 10 Sep 2017 20:35:54 +0000 (16:35 -0400)
[ Upstream commit a6cb3b864b21b7345f824a4faa12b723c8aaf099 ]

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>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
drivers/gpu/drm/msm/msm_gem_submit.c

index 4ff8c334e7c8a14262acfaf0a0be7017c15bd438..4a45ae01cc3eee1bc5847f5fa710d6f51ad9ecb1 100644 (file)
@@ -90,7 +90,8 @@ static int submit_lookup_objects(struct msm_gem_submit *submit,
                        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);
                        ret = -EINVAL;
                        goto out_unlock;