aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJordan Crouse <jcrouse@codeaurora.org>2017-05-08 14:34:58 -0600
committerRob Clark <robdclark@gmail.com>2017-05-27 13:48:29 -0400
commitd72fea538fe6d783c1e63a2fc304019abf4be93a (patch)
tree596d2f4822f66c3ae72b3f6922fdc7ffcdc621ab /drivers
parent90dd57de4a043f642179b1323a31ca3ced826611 (diff)
downloadlinux-actions-d72fea538fe6d783c1e63a2fc304019abf4be93a.tar.gz
drm/msm: Fix the check for the command size
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/msm/msm_gem_submit.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
index 8ac4ca44391465..7832e6421d250d 100644
--- a/drivers/gpu/drm/msm/msm_gem_submit.c
+++ b/drivers/gpu/drm/msm/msm_gem_submit.c
@@ -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;