]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drm/msm: Fix the check for the command size
authorJordan Crouse <jcrouse@codeaurora.org>
Mon, 8 May 2017 20:34:58 +0000 (14:34 -0600)
committerRob Clark <robdclark@gmail.com>
Sat, 27 May 2017 17:48:29 +0000 (13:48 -0400)
The overrun check for the size of submitted commands is off by one.
It should allow the offset plus the size to be equal to the
size of the memory object when the command stream is very tightly
constructed.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
drivers/gpu/drm/msm/msm_gem_submit.c

index 8ac4ca443914652a5fc65b00b9ca686e7f04412a..7832e6421d250d0bd78400057e46dce07dc2d18c 100644 (file)
@@ -495,8 +495,9 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
                        goto out;
                }
 
-               if ((submit_cmd.size + submit_cmd.submit_offset) >=
-                               msm_obj->base.size) {
+               if (!submit_cmd.size ||
+                       ((submit_cmd.size + submit_cmd.submit_offset) >
+                               msm_obj->base.size)) {
                        DRM_ERROR("invalid cmdstream size: %u\n", submit_cmd.size);
                        ret = -EINVAL;
                        goto out;