mirror of
https://github.com/armbian/linux-cix.git
synced 2026-01-06 12:30:45 -08:00
drm/msm/gem: prevent integer overflow in msm_ioctl_gem_submit()
[ Upstream commit 3a47f4b439beb98e955d501c609dfd12b7836d61 ]
The "submit->cmd[i].size" and "submit->cmd[i].offset" variables are u32
values that come from the user via the submit_lookup_cmds() function.
This addition could lead to an integer wrapping bug so use size_add()
to prevent that.
Fixes: 198725337e ("drm/msm: fix cmdstream size check")
Cc: stable@vger.kernel.org
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/624696/
Signed-off-by: Rob Clark <robdclark@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c620a776d7
commit
2b99b2c462
@@ -885,8 +885,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
|
||||
goto out;
|
||||
|
||||
if (!submit->cmd[i].size ||
|
||||
((submit->cmd[i].size + submit->cmd[i].offset) >
|
||||
obj->size / 4)) {
|
||||
(size_add(submit->cmd[i].size, submit->cmd[i].offset) > obj->size / 4)) {
|
||||
SUBMIT_ERROR(submit, "invalid cmdstream size: %u\n", submit->cmd[i].size * 4);
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
|
||||
Reference in New Issue
Block a user