All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Hellstrom <thellstrom@vmware.com>
To: dri-devel@lists.freedesktop.org
Cc: Vladis Dronov <vdronov@redhat.com>, stable@vger.kernel.org
Subject: [PATCH -fixes 1/9] drm/vmwgfx: limit the number of mip levels in vmw_gb_surface_define_ioctl()
Date: Wed,  7 Jun 2017 15:24:17 +0200	[thread overview]
Message-ID: <1496841865-2349-1-git-send-email-thellstrom@vmware.com> (raw)

From: Vladis Dronov <vdronov@redhat.com>

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

Cc: <stable@vger.kernel.org>
Signed-off-by: Vladis Dronov <vdronov@redhat.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 7681341..baf03d4 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -1279,6 +1279,9 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data,
 	if (req->multisample_count != 0)
 		return -EINVAL;
 
+	if (req->mip_levels > DRM_VMW_MAX_MIP_LEVELS)
+		return -EINVAL;
+
 	if (unlikely(vmw_user_surface_size == 0))
 		vmw_user_surface_size = ttm_round_pot(sizeof(*user_srf)) +
 			128;
-- 
2.7.4

             reply	other threads:[~2017-06-07 13:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-07 13:24 Thomas Hellstrom [this message]
2017-06-07 13:24 ` [PATCH -fixes 2/9] drm/vmwgfx: Don't create proxy surface for cursor Thomas Hellstrom
2017-06-07 13:24 ` [PATCH -fixes 3/9] drm/vmwgfx: Handle vmalloc() failure in vmw_local_fifo_reserve() Thomas Hellstrom
2017-06-07 13:24 ` [PATCH -fixes 4/9] drm/vmwgfx: Make sure backup_handle is always valid Thomas Hellstrom
2017-06-07 13:24 ` [PATCH -fixes 5/9] drm/vmwgfx: Make sure to update STDU when FB is updated Thomas Hellstrom
2017-06-07 13:24 ` [PATCH -fixes 6/9] drm/vmwgfx: Fix large topology crash Thomas Hellstrom
2017-06-07 13:24 ` [PATCH -fixes 7/9] drm/vmwgfx: fix spelling mistake "exeeds" -> "exceeds" Thomas Hellstrom
2017-06-07 13:24 ` [PATCH -fixes 8/9] drm/vmwgfx: Remove unused legacy cursor functions Thomas Hellstrom
2017-06-07 13:24 ` [PATCH -fixes 9/9] drm/vmwgfx: Bump driver minor and date Thomas Hellstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1496841865-2349-1-git-send-email-thellstrom@vmware.com \
    --to=thellstrom@vmware.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=stable@vger.kernel.org \
    --cc=vdronov@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.