mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vladis Dronov <vdronov@redhat.com>
To: Sinclair Yeh <syeh@vmware.com>
Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>,
	Thomas Hellstrom <thellstrom@vmware.com>,
	David Airlie <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel: drm/vmwgfx: limit the number of mip levels in vmw_gb_surface_define_ioctl()
Date: Tue, 4 Apr 2017 05:43:30 -0400 (EDT)	[thread overview]
Message-ID: <1482987345.10707415.1491299010939.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20170331150712.GB33594@syeh-m02>

Hello, Sinclair!

> Here, the check should be "> DRM_VMW_MAX_MIP_LEVELS" because req->mip_levels
> is only for one layer.

Got it, thanks!

> Also, as long as we can doing a check, I would suggest we check for 0 as
> well.

Do you mean a check for "req->mip_levels > 0" or for "req->mip_levels >= 0" ?

I glimpsed thru the code and I do not see problems with req->mip_levels being 0,
surely I may be mistaking.

Best regards,
Vladis Dronov | Red Hat, Inc. | Product Security Engineer


----- Original Message -----
From: "Sinclair Yeh" <syeh@vmware.com>
To: "Vladis Dronov" <vdronov@redhat.com>
Cc: "VMware Graphics" <linux-graphics-maintainer@vmware.com>, "Thomas Hellstrom" <thellstrom@vmware.com>, "David Airlie" <airlied@linux.ie>, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Sent: Friday, March 31, 2017 5:07:12 PM
Subject: Re: [PATCH] kernel: drm/vmwgfx: limit the number of mip levels in vmw_gb_surface_define_ioctl()

Hi Vladis,


On Thu, Mar 30, 2017 at 12:27:12PM +0200, Vladis Dronov wrote:
> 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://urldefense.proofpoint.com/v2/url?u=https-3A__bugzilla.redhat.com_show-5Fbug.cgi-3Fid-3D1437431&d=DwIBAg&c=uilaK90D4TOVoH58JNXRgQ&r=HaJ2a6NYExoV0cntAYcoqA&m=5yR87BuuU86aoAjCveInxh6jvgOyumqIHQhTs0xLo38&s=tWQs7vwNLgD_b2RWMddVtusEKh9FQTIF5rKFOWudslE&e= 
> Signed-off-by: Vladis Dronov <vdronov@redhat.com>
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
> index b445ce9..b30824b 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
> @@ -1281,6 +1281,10 @@ 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_SURFACE_FACES *
> +	    DRM_VMW_MAX_MIP_LEVELS)
> +		return -EINVAL;
> +

Here, the check should be "> DRM_VMW_MAX_MIP_LEVELS" because req->mip_levels
is only for one layer.

Also, as long as we can doing a check, I would suggest we check for 0 as
well.

Sinclair

      reply	other threads:[~2017-04-04  9:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-30 10:27 Vladis Dronov
2017-03-31 10:47 ` Vladis Dronov
2017-03-31 15:07 ` Sinclair Yeh
2017-04-04  9:43   ` Vladis Dronov [this message]

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=1482987345.10707415.1491299010939.JavaMail.zimbra@redhat.com \
    --to=vdronov@redhat.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-graphics-maintainer@vmware.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syeh@vmware.com \
    --cc=thellstrom@vmware.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®