From: Daniel Vetter <daniel@ffwll.ch>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] drm: prevent a harmless integer overflow in drm_legacy_sg_alloc()
Date: Sat, 29 Feb 2020 00:40:17 +0100 [thread overview]
Message-ID: <20200228234017.GB2363188@phenom.ffwll.local> (raw)
In-Reply-To: <20200228092321.axulddmkxrujkmas@kili.mountain>
On Fri, Feb 28, 2020 at 12:23:21PM +0300, Dan Carpenter wrote:
> There is an integer overflow when we round up to PAGE_SIZE, but it's
> harmless because we never re-use "request->size" for anything meaningful.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> This code predates git.
Also not compiled without CONFIG_DRM_LEGACY, which we tell everyone is to
enable the root holes in drm :-)
Thanks for your patch, queued in drm-misc-next.
-Daniel
>
> drivers/gpu/drm/drm_scatter.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_scatter.c b/drivers/gpu/drm/drm_scatter.c
> index d5c386154246..ca520028b2cb 100644
> --- a/drivers/gpu/drm/drm_scatter.c
> +++ b/drivers/gpu/drm/drm_scatter.c
> @@ -99,6 +99,9 @@ int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
> if (!drm_core_check_feature(dev, DRIVER_SG))
> return -EOPNOTSUPP;
>
> + if (request->size > SIZE_MAX - PAGE_SIZE)
> + return -EINVAL;
> +
> if (dev->sg)
> return -EINVAL;
>
> --
> 2.11.0
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
prev parent reply other threads:[~2020-02-28 23:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-28 9:23 Dan Carpenter
2020-02-28 23:40 ` Daniel Vetter [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=20200228234017.GB2363188@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=airlied@linux.ie \
--cc=dan.carpenter@oracle.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=tzimmermann@suse.de \
/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®