summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray McAllister <murray.mcallister@insomniasec.com>2017-03-27 11:15:12 +0200
committerBen Hutchings <ben@decadent.org.uk>2017-07-18 18:38:39 +0100
commit4a98780baa2d58c54f1ec593f8f34e3d1d6d6a9f (patch)
tree6c7e47f5b8edffd64ae922870ee9f59676036e46
parent5b989fa8e683f024aafdce3fa8b77189b03b3935 (diff)
downloadlinux-4a98780baa2d58c54f1ec593f8f34e3d1d6d6a9f.tar.gz
linux-4a98780baa2d58c54f1ec593f8f34e3d1d6d6a9f.tar.bz2
linux-4a98780baa2d58c54f1ec593f8f34e3d1d6d6a9f.zip
drm/vmwgfx: avoid calling vzalloc with a 0 size in vmw_get_cap_3d_ioctl()
commit 63774069d9527a1aeaa4aa20e929ef5e8e9ecc38 upstream. In vmw_get_cap_3d_ioctl(), a user can supply 0 for a size that is used in vzalloc(). This eventually calls dump_stack() (in warn_alloc()), which can leak useful addresses to dmesg. Add check to avoid a size of 0. Signed-off-by: Murray McAllister <murray.mcallister@insomniasec.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
index 66917c6c3813..bce40476f0b1 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
@@ -90,7 +90,7 @@ int vmw_get_cap_3d_ioctl(struct drm_device *dev, void *data,
void *bounce;
int ret;
- if (unlikely(arg->pad64 != 0)) {
+ if (unlikely(arg->pad64 != 0 || arg->max_size == 0)) {
DRM_ERROR("Illegal GET_3D_CAP argument.\n");
return -EINVAL;
}