Skip to content

Commit 619cc02

Browse files
nefigtutgregkh
authored andcommitted
drm/vmwgfx: limit the number of mip levels in vmw_gb_surface_define_ioctl()
commit ee9c4e681ec4f58e42a83cb0c22a0289ade1aacf upstream. The 'req->mip_levels' parameter in vmw_gb_surface_define_ioctl() is a user-controlled 'uint32_t' value which is used as a loop count limit. This can lead to a kernel lockup and DoS. Add check for 'req->mip_levels'. References: https://bugzilla.redhat.com/show_bug.cgi?id=1437431 Signed-off-by: Vladis Dronov <vdronov@redhat.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e4c05b3 commit 619cc02

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/gpu/drm/vmwgfx/vmwgfx_surface.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,9 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data,
12931293
if (req->multisample_count != 0)
12941294
return -EINVAL;
12951295

1296+
if (req->mip_levels > DRM_VMW_MAX_MIP_LEVELS)
1297+
return -EINVAL;
1298+
12961299
if (unlikely(vmw_user_surface_size == 0))
12971300
vmw_user_surface_size = ttm_round_pot(sizeof(*user_srf)) +
12981301
128;

0 commit comments

Comments
 (0)