]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm/vmwgfx: NULL pointer dereference in vmw_surface_define_ioctl()
authorMurray McAllister <murray.mcallister@insomniasec.com>
Mon, 27 Mar 2017 09:12:53 +0000 (11:12 +0200)
committerBrian Maly <brian.maly@oracle.com>
Tue, 8 May 2018 19:49:03 +0000 (15:49 -0400)
Before memory allocations vmw_surface_define_ioctl() checks the
upper-bounds of a user-supplied size, but does not check if the
supplied size is 0.

Add check to avoid NULL pointer dereferences.

Cc: <stable@vger.kernel.org>
Signed-off-by: Murray McAllister <murray.mcallister@insomniasec.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Orabug: 27913367
CVE: CVE-2017-7294

(cherry picked from commit 36274ab8c596f1240c606bb514da329add2a1bcd)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
Reviewed-by: Shan Hai <shan.hai@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c

index 17a4107639b2abc7fd7896e1ec239aad057728b4..53a8aa716a98265c6ccfd446d0b1dc532683b968 100644 (file)
@@ -714,8 +714,8 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
        for (i = 0; i < DRM_VMW_MAX_SURFACE_FACES; ++i)
                num_sizes += req->mip_levels[i];
 
-       if (num_sizes > DRM_VMW_MAX_SURFACE_FACES *
-           DRM_VMW_MAX_MIP_LEVELS)
+       if (num_sizes > DRM_VMW_MAX_SURFACE_FACES * DRM_VMW_MAX_MIP_LEVELS ||
+           num_sizes == 0)
                return -EINVAL;
 
        size = vmw_user_surface_size + 128 +